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

With `nim cpp` the Nim compiler actually just generates C++ from the Nim source for the backend to compile. So, calling C++ code is just emitting the calls at a C++ source level and so is straightforward. The situation with Rust "sharing" LLVM is very different, as that is not a source-to-source compiler.

C++ code calling Nim code is also not usually as straightforward. So, "fantastic" here may apply only in one call direction.



The way to enable C++ code calling Nim is via exportc or exportcpp and by writing a head file with the declarations you are exporting

This will require manual work, but you can use macros or a code generation script to help if your api is large.




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

Search: