-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cargo install a library as .dll / .so file #8317
Comments
@ehuss do you need any help with this? I am interested in getting it to work, though I had a slightly different implementation in mind, something that is useful for Linux distributions and similar users. I would like a way to build and install projects as dynamic libraries, and a way to tell cargo to link against dynamic libraries on the system instead of building the crates. I would be happy to throw some time into this if needed 😊 |
Just to chime in, I'd find this really useful for myself as well. There's a lot of times where I want to gradually introduce Rust into a non-Rust codebase by using a For breaking dependencies between CI builds, it'd be really helpful if I could have the C build run |
I find this useful as well. |
Semi-related. Cargo gets an unstable feature https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#artifact-dependencies |
Oh wow! That's exactly what I need! Thank you. Is it possible to get the cdylib of the same package? for example package |
The interface to define an artifact dependency is specifying dependencies in |
Any updates? |
Describe the problem you are trying to solve
I have a rather large library (azul-dll), which can be compiled to a
cdylib
. The library itself has 200+ dependencies (already tried to optimize it) and rebuilding code that uses that library takes ~30s, which is slow.My plan to speed up compile time was to do something like this:
Then, in the main
azul
library, include and load the pre-compiled DLL:This solution would especially speed up the link time, which is often greater than the compile time itself.
For a release build, the user could specify via feature-flags whether the DLL is loaded from the system and deployed alongside the binary or in a separate package (for example, to work with things like
apt
on Linux) or if the DLL should be included in the binary for deployment on systems that have little to no library dependency management (Windows), with the disadvantage of slight binary bloat.Describe the solution you'd like
Currently you can only install binaries from crates.io, it would be great if you could also install DLL / .so files directly from crates.io if they have a
crate-type=cdylib
in their Cargo.toml.I could maybe hack around this with giving
azul-dll
amain.rs
file, which the bootstraps itself, and builds and installsazul-dll
in the correct directory, but it would be better to have a standardized solution for installing DLLs, especially for security purposes.Lastly, if something like that would be considered, I've noticed that there is a
strip
command for cargo now - could the command / rustc be modified to only strip debug information, not function names (which are important for dynamically loading a library)? Thanks in advance for any help.The text was updated successfully, but these errors were encountered: