lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi list,
In a current project, I need to be able to grab symbols from a loaded
C module like static functions etc., but I don't want to have to
provide a reference to the module in question as having to keep track
of structures (on OSX) like NSModule will be clumsy.  Looking at
loadlib.c, there's this line:


NSModule mod = NSLinkModule(img, path, NSLINKMODULE_OPTION_PRIVATE |
                       NSLINKMODULE_OPTION_RETURN_ON_ERROR);


Is there a reason for the NSLINKMODULE_OPTION_PRIVATE flag?  I realize
it keeps the module from polluting the globals table, but for my
purposes this prevents me from having the symbols in question readily
available.  I'm wondering what issues there would be in removing this
flag.  In what tech notes I found on the subject I didn't see any
gotchas, but there's probably something lurking there.  If removing
this flag isn't an option, would it be possible to have a config
option to say "yes, I want C module symbols in the globals table"?

The reason I need this behavior is I'm using LLVM to generate
functions etc. form within Lua scripts and I want to be able to hook
in to functions defined in C modules without necessarily having to
build a shared lib and a lua module for each case where I want this
behavior.

thanks,
wes