-
Notifications
You must be signed in to change notification settings - Fork 286
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
Fixed crate type #358
Fixed crate type #358
Conversation
@katyo So if I understand correctly, the I think having this as an option makes sense. The big question in my mind is which should be the default. The main tradeoff seems to me to be: transparency vs sharing. The benefit of transparency is that deployment machines don't need to have anything special installed on them. The benefits of sharing are decreased filesystem and memory footprint (especially when there are multiple Neon modules in a single app's dependency graph) and ugpradability (e.g. for security fixes to libstd). In reality, right now I don't think many people are building libraries with Neon, so the question is not urgent. I'd just like to have a good understanding of the tradeoffs for the long term. |
Whether you build as |
A followup: I talked with Alex Crichton to learn a little more about cdylib. Alex agreed with @retep998's opinion: cdylib is first and foremost the choice you should use whenever building for linking from a non-Rust language. Alex also added that he believes that cdylib does static linking by default, and he argued that this is what we want. In particular, related to my claim above:
Alex argued that none of the benefits of dynamic linking are actually there for the Rust stdlib, for several reasons:
I find this pretty compelling. Just thought I'd note that here for posterity. |
The proper crate type should be "cdylib" not "dylib" because "dylib" produces an extra dependency from
libstd.so
which cannot be resolved at runtime in common case.With "dylib":
The "not found" means the problems with module loading by node:
With "cdylib":