3 ms·
> Let me compile to shared libraries. I compile Rust to shared .dll and .so libs all the time. Is this what you're looking for? --crate-type=dylib, #[crate_
by ModernMech 5y ago
> Let me compile to shared libraries.
I compile Rust to shared .dll and .so libs all the time. Is this what you're looking for?
--crate-type=dylib, #[crate_type = "dylib"] - A dynamic Rust library will be produced. This is different from the lib output type in that this forces dynamic library generation. The resulting dynamic library can be used as a dependency for other libraries and/or executables. This output type will create *.so files on Linux, *.dylib files on macOS, and *.dll files on Windows.
https://doc.rust-lang.org/reference/linkage.html https://doc.rust-lang.org/reference/linkage.html
- Luker88 5y agoNo, I guess I wrote the message too quickly and explained poorly, my bad. I meant compiling a program and linking the crates as shared libraries. Kinda like a normal C/C++ program, and how the whole linux wolrd works. ...and I guess even the strong newtype wrapper is actually there with `struct Newtype(type);`, but I end up having way too many `.0` everywhere that I really dislike I'll try not to post before my morning coffee next time :p
- ModernMech 5y ago> I meant compiling a program and linking the crates as shared libraries. Okay I see. You can kind of get this from the libloading crate. https://docs.rs/libloading/latest/libloading/ https://docs.rs/libloading/latest/libloading/ It works but it’s not great.