by newpavlov · 4y ago · 0 comments
Using D code in Rust probably will be much more painful and I am not sure if it can be done 100% safely...
You can just as easily declare D code to be extern(C) and have rust treat it as a C library.
Can you elaborate? Saying it will be "much more painful" without anything further is not especially helpful. I've added D functions to C programs more or less trivially, including compiling to a shared library, with no change to the code.
D's betterC mode ensures that the binary can run purely on libc without D's runtime library. It's kind of like being able to link and execute C++ code without needing libcxx.