Is there a way to run a shell command after my cdylib has been successfully built?
⚓ Rust 📅 2025-07-09 👤 surdeus 👁️ 16I'm creating a Neovim plugin with the nvim_oxi crate.
It builds a C dynamic library that can be loaded and used by Neovim's Lua API.
cargo generates a cdylib artifact named libexample.so for example, but I want to remove the lib prefix because when I call require("example") in Lua, it looks for example.so, not libexample.so.
- If I want to do something like this, is it common practice to write a shell script that wraps
cargo build? Or does Cargo support something like a post-build hook, or a way to set the artifact name for acdylib? - Is there a way to get the file path of the artifact generated by
cargo build, so that I can rename it? (Ideally, the method should work for both debug and release builds.)
2 posts - 2 participants
🏷️ rust_feed