Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You mean to link against Rust binaries or can you make library files too? Compared to, say, SQLite as a single C file, I thought that Rust projects are not super easy to use as a dependency


Rust can output library files that use the C calling convention, either static or dynamic. Doing this entirely by hand is pretty annoying, because your API surface has to be C-compatible (so can't contain a lot of Rust's useful language features) and because you still have to do the other half of the FFI to use the library from the other language. However, it's possible to develop automated language-specific tooling to make this easier, with PyO3 being a particularly impressive example.


Depends on how you link rust, using PyO3 makes it arguably easier to do link python code to rust than any C construction I could think off. Linking a single C file into python is quite difficult (if not using JIT like cppyy) because you need to make bindings & conversion often on both sides for each exported function.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: