7 ms·
Is there something like extern "C" { void foo(); } For D? That way you'd be able to use the LuaJIT ffi. That, in combination with what's in the OP, would
by rweichler 9y ago
Is there something like
extern "C" { void foo(); }
For D? That way you'd be able to use the LuaJIT ffi. That, in combination with what's in the OP, would be killer.
- edmccard 9y agoYep, except you'd write it extern(C) { void foo(); } https://dlang.org/spec/interfaceToC.html https://dlang.org/spec/interfaceToC.html
- vram22 9y agoHere is an example: https://jugad2.blogspot.in/2016/09/calling-simple-c-function-from-d-strcmp.html https://jugad2.blogspot.in/2016/09/calling-simple-c-function...
- shakna 9y agoYes [0]. extern (C++) int foo(int i, int j, int k); In fact, D can both access C++, and C++ can access D, as you can see further down that link, on classes. But, if you don't want C++, then [1]: extern (C) int foo(int i, int j, int k); Which is actually in the article. [0] http://dlang.org/spec/cpp_interface.html http://dlang.org/spec/cpp_interface.html [1] http://dlang.org/spec/interfaceToC.html http://dlang.org/spec/interfaceToC.html