lua-users home
lua-l archive

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

Hi list,

The problem of the Lua windows dll naming being recurrent, I decided
to write a simple script to easily create a proxy dll like the one
available in the latest LuaBinaries builds. The script uses VisualC++
to create a dll named <fakelib> forwarding all Lua API calls to
another dll named <reallib>, where reallib and fakelib are parameters
to the script.

The script is available on Lua wiki [1] and I put a little description
at the bottom of the page BuildingLua [2]. Here is the usage help :

Usage: mkforwardlib <reallib> <fakelib> <machine> [<extrasymbols>...]

   reallib         The name of the existing dll that you want to use (without
   fakelib         The name of the fake dll that you want to create and that
                   will call the reallib instead (without extension).
   machine         The hardware architecture of your windows version among:
                   X86, AMD64, IA64
   extrasymbols    Additionnal symbols to export beyond standard Lua symbols
                   (if you have a very custom Lua dll).

For example if you built Lua with the standard makefiles (which create
a dll named lua51.dll) and downloaded one of the LuaBinaries
precompiled modules (which use a dll named lua5.1.dll), you would
invoke the tool like this :

lua mkforwardlib.lua lua51 lua5.1 X86

By default it does only export functions lua_* and luaL_*, but if you
need to access luaopen_* functions or other internal functions from
the Lua DLL you can add them as arguments on the command line. For
example :

lua mkforwardlib.lua lua.5.1.2 lua.5.1 X86 luaopen_base luaopen_loadlib

I didn't test it extensively since I don't need it in my current
projects, but it worked on a simple X86 test with LuaFileSystem (taken
precompiled from LuaForge, and with a custom built lua.dll). Any
feedback will be appreciated. You can also directly modify it on the

I hope that will be of some help :-)