Eric Tetz |
|
Immediately after posting CreatingBinaryExtensionModules, I discovered the similar BinaryModuleTutorial. However, that tutorial does not address the issue of where the Lua API routines are located. If they are statically linked into the host application, then the extension cannot use them (unless the host is specifically written to pass function pointers to the DLL, a mechanism outside the scope of 'loadlib'). So the DLL must statically link to it's own copy of the Lua API routines. If the Lua API uses any static variables (I don't know that it does) the host and the extension will have separate copies, and things could go horribly wrong.
However, since there is no mention of this issue in the BinaryModuleTutorial, it appears that Lua does not use any static data, and that creating modules as described there actually works. It just wastes space, as every extension module contain it's own copy of the entire Lua API.