3 ms·
How to generate Lua boilerplate with D
- jordigh 9y agoIf you haven't seen this, the D Gems section of the D Tour highlights some of D's most exciting features: https://tour.dlang.org/tour/en/gems/uniform-function-call-syntax-ufcs https://tour.dlang.org/tour/en/gems/uniform-function-call-sy... In particular, here is another explanation of the scope feature presented in the LuaD article: https://tour.dlang.org/tour/en/gems/scope-guards https://tour.dlang.org/tour/en/gems/scope-guards
- rweichler 9y agoIs 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