3 ms·
The C ABI is not great for interacting with scripting languages though, even if it is the best we have right now. For a start there is no type information obtai
by justincormack 14y ago
The C ABI is not great for interacting with scripting languages though, even if it is the best we have right now. For a start there is no type information obtained with dlsym and you basically have to parse headers the interpretation of which is not clearly defined as the C language really defines an API and the ABI is defined by the compiler. Many libraries for this reason do not define stable ABIs and are a pain to use from a scripting language. Hence Python has two ffi modes an ABI interface and a compiler mode.
Now if someone produced a better solution to that it would be useful...
- qznc 14y agoIn practice it works quite well, if you restrict the ABI to function calls and word-sized values (long and void). It especially means not to use structs. Instead you need void and getter/setter functions.
- justincormack 14y agoThats very limiting. A lot of applications need arrays (and maybe complex numbers) eg for numerical applications. And it is hard to manage without some sort of int64 type nowadays. And also say you want performance, then using getters and setters sucks compared to direct struct access, as every access needs a non inlineable function call.
- angersock 14y agoYou know, it's strange, because the Lua folks seem to be getting along just fine.
- justincormack 14y agoYeah but us Lua folks are picky about the sort of C we like to interface to.