lua-users home
lua-l archive

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


On 11/8/06, Jérôme VUARAND <jerome.vuarand@gmail.com> wrote:
2006/11/8, Simon Wittber <simonwittber@gmail.com>:

The function to load a dynamic library is 'package.loadlib'. The
'require' function can also do that if the library is built around the
Lua package model.

And I'd like to add that contrary to what Thomas wrote, loading a
dynamic/shared library the way Lua does it, that is by calling
LoadLibrary/dlopen and then getting a pointer to the functions in the
DLL, is faster than using a stub library and statically linking to
that stub library. The stub static library adds a level of indirection
compared to the use of functions pointer retrieved directly from the
manually loaded dll.

Well.. if you want to call functions with the int fn(lua_State*)
signature... I think what he means is calling into other libraries,
such as opengl/openal/sdl/etc...

--
Thomas Harning Jr.