Embedding LUA in PureBasic!?
- DoubleDutch
- Addict
- Posts: 3220
- Joined: Thu Aug 07, 2003 7:01 pm
- Location: United Kingdom
- Contact:
Re: Embedding LUA in PureBasic!?
Updated again to include the mac version of the lib, thanks to @jack .
https://dl.dropboxusercontent.com/u/171 ... lua514.zip
https://dl.dropboxusercontent.com/u/171 ... lua514.zip
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
https://reportcomplete.com <- School end of term reports system
Re: Embedding LUA in PureBasic!?
Would someone be willing to create a tutorial on how to build Lua statically for use with PureBasic? I think it would be very useful, as this question seems to come up often. It would be helpful for people to be able to build the new versions as they come out.
I have been trying to build Lua 5.3.0 for x64 with Visual Studio Express 2012, but when I try to use the .lib file with PureBasic x64, I get errors such as, ""POLINK: fatal error: Corrupt library: 'C:\...\lua5.3.0.lib'; unable to find symbol 'luaopen_base' in member 'x64\Release\lbaselib.obj'."
Eventually I'd like to be able to use Lua on all three platforms, both x86 and x64, where applicable...but that's probably a battle later down the road.
Thanks.
I have been trying to build Lua 5.3.0 for x64 with Visual Studio Express 2012, but when I try to use the .lib file with PureBasic x64, I get errors such as, ""POLINK: fatal error: Corrupt library: 'C:\...\lua5.3.0.lib'; unable to find symbol 'luaopen_base' in member 'x64\Release\lbaselib.obj'."
Eventually I'd like to be able to use Lua on all three platforms, both x86 and x64, where applicable...but that's probably a battle later down the road.
Thanks.
Re: Embedding LUA in PureBasic!?
Hi,
Try disable optimizations and incremental linking!
Try disable optimizations and incremental linking!
Re: Embedding LUA in PureBasic!?
I disabled optimizations, and I get the same errors. I cannot find an option to disable incremental linking (I also have no "Linker" options in the Project Properties).acreis wrote:Hi,
Try disable optimizations and incremental linking!
Re: Embedding LUA in PureBasic!?
hello wombats
would you post your test code?
I would like to the the lua libs on my system
would you post your test code?
I would like to the the lua libs on my system
Re: Embedding LUA in PureBasic!?
I used the code in the zip file posted by DoubleDutch.
I wanted to create an x64 build of Lua, since that's what I mainly use.
All I've done is created a static library project in Visual Studio 2012 and added the Lua source and header files to it. I updated the version, etc. in the lua.pbi file to match the version of Lua I built:
Am I missing some vital step? Haha.
I wanted to create an x64 build of Lua, since that's what I mainly use.
All I've done is created a static library project in Visual Studio 2012 and added the Lua source and header files to it. I updated the version, etc. in the lua.pbi file to match the version of Lua I built:
Code: Select all
#LUA_VERSION = "Lua 5.3"
#LUA_RELEASE = "Lua 5.3.0"
#LUA_VERSION_NUM = 503
#LUA_COPYRIGHT = "Copyright (C) 1994-2007 Lua.org, PUC-Rio"
#LUA_AUTHORS = "R. Ierusalimschy, L. H. de Figueiredo & W. Celes"
; mark for precompiled code
#LUA_SIGNATURE = "\x1bLua" ;"\033Lua"
Re: Embedding LUA in PureBasic!?
About incremental linking:
https://blogs.msdn.microsoft.com/zhanli ... r-symbols/
https://blogs.msdn.microsoft.com/zhanli ... r-symbols/
Re: Embedding LUA in PureBasic!?
I had seen that page, but as I said, I do not have that option: http://imgur.com/a/ovM1g
I had read that it is because my project is setup to create a static library.
I had read that it is because my project is setup to create a static library.
Re: Embedding LUA in PureBasic!?
@wombats
I compiled lua5.3.0 to 64-bit lib but there are polink errors, then I tried lua5.1.5 but still get polink errors.
then I built a dll using msys2 and polib to build the import lib, everything works ok with version 5.1.5 but not with version 5.3.0.
I compiled lua5.3.0 to 64-bit lib but there are polink errors, then I tried lua5.1.5 but still get polink errors.
then I built a dll using msys2 and polib to build the import lib, everything works ok with version 5.1.5 but not with version 5.3.0.
Re: Embedding LUA in PureBasic!?
I don't know anything about mysys2 and polib.
I tried Lua 5.1.4, but I get new errors: http://imgur.com/a/J8c6G
I tried Lua 5.1.4, but I get new errors: http://imgur.com/a/J8c6G
- DoubleDutch
- Addict
- Posts: 3220
- Joined: Thu Aug 07, 2003 7:01 pm
- Location: United Kingdom
- Contact:
Re: Embedding LUA in PureBasic!?
The one in my zip file?
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
https://reportcomplete.com <- School end of term reports system
- DoubleDutch
- Addict
- Posts: 3220
- Joined: Thu Aug 07, 2003 7:01 pm
- Location: United Kingdom
- Contact:
Re: Embedding LUA in PureBasic!?
By the way, the reason I've stuck with 5.1.4/5 is because 5.3 has change the way floats and ints are recognised - you define a float with 5.3 with a . else it's and int. In versions below this everything was a float. No-one seems to like the way you define the floats (it breaks compatibility) so this may change to another method with 5.4 .
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
https://reportcomplete.com <- School end of term reports system
Re: Embedding LUA in PureBasic!?
No, I've been trying to build it successfully myself so I know how. I want to be able to use it with x64 PureBasic, also. I'm just not getting anywhere.
Re: Embedding LUA in PureBasic!?
hello wombats
I have not tried this myself but if you want to try compile using the command line then the instructions found on https://lua64bit.wordpress.com
might do the trick
from the command prompt cd to the lua src directory
(edit the path of your vs installation and lua version below)
edit: just tried it and the static lib of version 5.1.5 works ok compiling as above
also the dll and import lib work ok
I have not tried this myself but if you want to try compile using the command line then the instructions found on https://lua64bit.wordpress.com
might do the trick
from the command prompt cd to the lua src directory
(edit the path of your vs installation and lua version below)
note that lua version 5.3.0 does not have some of the functions that are in version 5.1.5 so your test code may need changing"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" amd64
cl /MD /O2 /c /GS- /DLUA_BUILD_AS_DLL *.c
ren lua.obj lua.o
ren luac.obj luac.o
link /DLL /IMPLIB:lua5.3.0.lib /OUT:lua5.3.0.dll *.obj
link /OUT:lua.exe lua.o lua5.3.0.lib
lib /OUT:lua5.3.0-static.lib *.obj
link /OUT:luac.exe luac.o lua5.3.0-static.lib
edit: just tried it and the static lib of version 5.1.5 works ok compiling as above
also the dll and import lib work ok
- DoubleDutch
- Addict
- Posts: 3220
- Joined: Thu Aug 07, 2003 7:01 pm
- Location: United Kingdom
- Contact:
Re: Embedding LUA in PureBasic!?
Make sure that if you compile with Visual C that you also don't need all the visual C baggage (sometimes you need to distribute extra dll s)...
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
https://reportcomplete.com <- School end of term reports system