Skip to content
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

Should this use Rust ABI dylib or the C/C++ ABI cdylib #4

Closed
CGMossa opened this issue Nov 23, 2020 · 6 comments
Closed

Should this use Rust ABI dylib or the C/C++ ABI cdylib #4

CGMossa opened this issue Nov 23, 2020 · 6 comments

Comments

@CGMossa
Copy link
Member

CGMossa commented Nov 23, 2020

While diagnosing my initial build issues on windows, see #2 , I found this thread describing the difference between cdylib and dylib. Turned out, it wasn't an issue for me to use dylib, but this might be a problem down the line. Also, r-rust/hellorust uses cdylib.

This is specifically concerning the generated Cargo.toml file in the source.R file.

@clauswilke
Copy link
Member

What change is needed to switch to cdylib? It sounds to me like it's the right thing to do.

@CGMossa
Copy link
Member Author

CGMossa commented Nov 23, 2020

It just requires changing generate_cargo.toml. I just don't know what the consequences of that is.
Maybe it entails longer compile time, or some restriction, that I'm unfamiliar with.
For instance, the hello-code in the README.md is 7.1 MB when using dylib and 5.5 MB when using cdylib.

Hopefully @dasmoth or Andy have some ideas what this decision entails.

@clauswilke
Copy link
Member

Tagging @andy-thomason so he sees this issue.

@andy-thomason
Copy link

It seems that cdylib is intended for building C API extensions for other things that
expect it (such as R) ie. C <-> Rust.

dylib is for extending Rust frameworks and presumably allows rust functions
to call Rust functions Rust <-> Rust.

I would definitely go for cdylib as the C ABI has remained invariant for decades
apart from some minor bug fixes.

@clauswilke
Copy link
Member

Sounds good, I'll switch to cdylib.

@clauswilke
Copy link
Member

This is done now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants