lua-users home
lua-l archive

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


Shmuel Zeigerman wrote:
> Your solution is probably better than mine, but it's (currently)
> "Visual Studio only". I, for example, don't have one. My solution
> (though not optimal) works correctly and that is what matters for me.

There's a free version of Visual C++ available on Microsoft website for
at least the X86, AMD64 and IA64 architectures. And if you don't even
have windows to run them, I think they can be run from wine without much
trouble.

> I tried to find a simpler and more elegant solution for gcc/mingw but
> with no success. If someone comes up with such a solution (there must
> be one!), I will gladly use it (and remove mine from the wiki).  

The problem was challenging enough that I took some time on my regular
sleep time and work time (I hope my boss is not reading this :-) ) to
find a solution, and I finally came to one. To create export forwarders
with GCC you have to create a def file with entries of the form "EXPORTS
symbol=dll.symbol" where symbol is the symbol name and dll is the name
of the dll to which forwarding calls. To remove the dll default entry
point code (and remove the dependency to the C runtime and to the
kernel), you have to use the -nostartfiles gcc switch.

I created a Lua script to generate the def file and run gcc on the page
below. The script for VC++ is at the top, the one for GCC is at the
bottom.

http://lua-users.org/wiki/LuaProxyDllThree