-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Apparantly one C module in lua can never use another C module in lua directly. You look for the install path for .h files in luarocks and it just ain't there. And dlopen("buffer.so") doesn't expose any buffer_* symbols to dlopen("something_using_buffers.so"), so the latter can never load without link errors. I can see two solutions, neither of them good.
- make a non-lua buffer library, and the lua_buffer module just a thin interface to use it. Then something_using_buffers could also link to that non-lua library. Biggest problem being it's not Lua, and telling someone "this module will work great as soon as you use your package manager thingy to install our dependencies manually" isn't my idea of schway.
- use dlopen from inside something_using_buffers to dlopen("buffer.so") again, so that it can then use dlsym to get at the buffer_* symbols. Besides being ugly and incurring possible overhead for every buffer_* call, this also requires I determine the path of the buffer module, something Lua well uh, completely hides in binary code. I could try to call debug.getinfo to try to get the "source" file, which should be the .so, but I think it's just "[C]" instead of any .so filename. So I'd have to walk package.cpath manually a second time, and hope that it hasn't changed since requiring buffer.so otherwise I could get the wrong buffer.so file entirely, and hope buffer.so hasn't been loaded by a custom loader and isn't on package.cpath at all.
Not really sure what to do at this point. module A wants to use buffer_set, how do?
Metadata
Metadata
Assignees
Labels
No labels