lua-users home
lua-l archive

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

> Thus in short extension DLLs will make C/C++ functions available to LUA
> from their DllMain function and because the extension DLLs get linked with
> the import LIB from LUA.DLL they have access to the LUA functions without
> needing to have a control structure with all available LUA functions,etc
> (and not having to call a "register" function yourself)
> I haven't got a chance to try this explicitly because I'm currently busy
> with some other things (altough I have got a LUA.DLL at the moment and I
> did some test regarding DLLs and LoadLibrary), but I think it should
> work... any suggestions or remarks if this idea would (not) work?

I think your plan will work.

Don't forget to un-register your lua functions from your dll's clean-up
code.  Otherwise Lua will end up with invalid function pointers.

There isn't a lua_unregister macro, but this should do the trick:

#define lua_unregister(n)	(lua_pushnil(), lua_setglobal(n))