4 ms·
You can provide C bindings for you Rust library.
by whyever 11y ago
You can provide C bindings for you Rust library.
- masklinn 11y agoWhich is "for widespread libraries, the choices are basically C, C++, and now (hopefully) rust.": as in C++ you can use high-level constructs internally without relying on an extensive runtime, and expose and easy-to-FFI C interface. Rust still has insufficiencies though, the inability to customise the (library's) allocator is one I think.
- steveklabnik 11y agoYou can use a custom allocator on nightly.
- masklinn 11y agoDoes the custom allocator support allow for runtime customisation e.g. the library user calling it to set allocator functions then starting to use it? And I expect the custom allocator is global?
- steveklabnik 11y agoCurrently, it replaces the global allocator. Using multiple allocators is an interface that's still being actively worked on, it's in the RFC stage, so no code has landed yet.
- Manishearth 11y agoIt's a build option, and yes, it's global, but of course you can build an allocator that respects some global parameters.