Hi All,
I'm trying to create a native library to use with LÖVE, but I don't know how to create the DLL.
Obviously, my DLL calls Lua functions, so I must link the object file against something that provides these functions. However:
1. There isn't a Lua DLL in the 0.8.0 LÖVE distribution to link against.
2. I can't link against a static Lua library because LÖVE would use one version of the code and my DLL, another.
3. I don't think I should LoadLibrary love.exe and get function pointers for Lua functions in there, and I don't think they are dllexported anyway.
I think option #1 would be the right way to tackle this, but LÖVE links against Lua statically. How should I link my DLL?
Thanks in advance,
Andre
How to create a native library
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: How to create a native library
Yeah, it's a bit ugly with 0.8.0. It will be better in 0.9.0.
Good thing 0.9.0 is coming soon™. Maybe we can tickle an import library or export file out of rude.
That should work more or less, Lua's API is lenient like that. It's obviously not the right thing to do, but I haven't encountered a library that didn't work (although I didn't test many).2. I can't link against a static Lua library because LÖVE would use one version of the code and my DLL, another.
Good thing 0.9.0 is coming soon™. Maybe we can tickle an import library or export file out of rude.
Shallow indentations.
Re: How to create a native library
Well, that will do before 0.9.0.
What Lua version is the precompiled LÖVE 0.8.0 linked against to?
Thanks,
Andre
What Lua version is the precompiled LÖVE 0.8.0 linked against to?
Thanks,
Andre
Re: How to create a native library
The official LÖVE 0.8.0 binary for Windows x86 has Lua 5.1.4. At least that's what the version string in the executable says.
Shallow indentations.
Re: How to create a native library
Well, I don't think it works...
LÖVE is compiled with MS' compiler, I'm compiling Lua with MinGW, so there must be some incompatibility between the generated code (alignment?) that is randomly causing this problem.
I'll try to compile LÖVE myself, and link it against lua51.dll.
Code: Select all
Program received signal SIGSEGV, Segmentation fault.
0x6c94ad56 in newkey () from c:\Users\aleirade\Dropbox\MinGW_home\luadm\love-0.8.0-win-x86\luadatamatrix.dll
(gdb) bt
#0 0x6c94ad56 in newkey () from c:\Users\aleirade\Dropbox\MinGW_home\luadm\love-0.8.0-win-x86\luadatamatrix.dll
#1 0x6c94ab5b in luaH_setnum () from c:\Users\aleirade\Dropbox\MinGW_home\luadm\love-0.8.0-win-x86\luadatamatrix.dll
#2 0x6c943ba4 in lua_rawseti () from c:\Users\aleirade\Dropbox\MinGW_home\luadm\love-0.8.0-win-x86\luadatamatrix.dll
#3 0x6c9414c9 in get_codes (L=0x343548) at luadatamatrix.cpp:85
#4 0x01494282 in ?? ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)
I'll try to compile LÖVE myself, and link it against lua51.dll.
Re: How to create a native library
Oh, yeah. If you do stuff like that..leiradel wrote:LÖVE is compiled with MS' compiler, I'm compiling Lua with MinGW, so there must be some incompatibility between the generated code (alignment?) that is randomly causing this problem.
You could link against a lua51.dll built with msvc. https://bitbucket.org/Boolsheet/love_wi ... -5.1.5.zip
Rebuilding LÖVE would be the clean thing to do indeed.
Shallow indentations.
Re: How to create a native library
Code: Select all
1>LINK : fatal error C1047: The object or library file 'lib\libmpg123.lib' was created with an older compiler than other objects; rebuild old objects and libraries
1>LINK : fatal error LNK1257: code generation failed
Re: How to create a native library
I don't think they ship the compilers and Visual Studio separately. Probably because both rely on some shared library.
Perhaps in the Windows SDK? I remember that Visual Studio 9 Express didn't have x86-64 compilers and needed the Windows SDK for them. That probably has changed with the Windows SDK 7 and 8 though.
I'll try to put some batch files together for the dependencies. Very minimal approach at a build system.
Perhaps in the Windows SDK? I remember that Visual Studio 9 Express didn't have x86-64 compilers and needed the Windows SDK for them. That probably has changed with the Windows SDK 7 and 8 though.
I'll try to put some batch files together for the dependencies. Very minimal approach at a build system.
Shallow indentations.
Re: How to create a native library
No game. I can compile LÖVE with my version of MS compiler but then it complains about the compiler used to compile the objects in the lib files being old.
I tried to compile LÖVE with MinGW, but there's one symbol in one of the objects that is undefined during link: __security_cookie
Oh well, I'll try to locate some SDL bindings for Lua that I wrote a couple of years ago and give it a go. Let's see if LÖVE 0.9.0 will have better support for the compilation of native libraries on Windows.
I tried to compile LÖVE with MinGW, but there's one symbol in one of the objects that is undefined during link: __security_cookie
Oh well, I'll try to locate some SDL bindings for Lua that I wrote a couple of years ago and give it a go. Let's see if LÖVE 0.9.0 will have better support for the compilation of native libraries on Windows.
Who is online
Users browsing this forum: Bing [Bot], slime and 70 guests