Binding Lua 5.3.4 to PureBasic 5.51 Application (x64)

Just starting out? Need help? Post your questions and find answers here.
User avatar
Crusiatus Black
Enthusiast
Enthusiast
Posts: 389
Joined: Mon May 12, 2008 1:25 pm
Location: The Netherlands
Contact:

Binding Lua 5.3.4 to PureBasic 5.51 Application (x64)

Post by Crusiatus Black »

Hey there!

I'm trying to import functions from the Lua 5.3.4 binaries on Windows.
I have the lua53.dll file and the liblua53.a library for binding. The thing is, PureBasic nowadays is unicode by default (and that's absolutely fine), however it seems to not cope with the fact that the Lua binaries are compiled with ascii settings (Lua does not support unicode). When I use the binding method (ImportC "lualib53.a") I get the annoying Windows runtime error saying:
---------------------------
PureBasic_Compilation0.exe - Entry Point Not Found
---------------------------
The procedure entry point PostThreadMessageA could not be located in the dynamic link library <path>\PureBasic_Compilation0.exe.
---------------------------
OK
---------------------------
Does anyone know of a way how I can still link with this Ascii library? I don't want to have to prototype every single symbol in the DLL.

Cheers,
Bas
Image
Bas Groothedde,
Imagine Programming

I live in a philosophical paradoxal randome filled with enigma's!
User avatar
Dadido3
User
User
Posts: 52
Joined: Sat Jan 12, 2008 11:50 pm
Location: Hessen, Germany
Contact:

Re: Binding Lua 5.3.4 to PureBasic 5.51 Application (x64)

Post by Dadido3 »

Hello,

you are trying to link a static library for linux (liblua53.a) on windows, that's why you get the error. The correct way would be to use the dll and the lua53.lib for windows, and link it dynamically. Theoretically you can link it statically too; I tried but i didn't got the lib from the official source to work with PureBasic.

Here is the include i created about a year ago: https://github.com/Dadido3/Lua-PureBasic
It contains the binaries of 5.3.3 or earlier, but the include should be compatible with the newer dll/lib files. I use utf-8 pseudotypes for all strings, so it will work with unicode. It's fully compatible with unicode characters in function names, strings and all the other stuff. (See http://lua-users.org/wiki/LuaUnicode)

I should probably update the github with the newest lua binaries soon. If there is still a problem just ask.
User avatar
Crusiatus Black
Enthusiast
Enthusiast
Posts: 389
Joined: Mon May 12, 2008 1:25 pm
Location: The Netherlands
Contact:

Re: Binding Lua 5.3.4 to PureBasic 5.51 Application (x64)

Post by Crusiatus Black »

Dadido3 wrote:Hello,

you are trying to link a static library for linux (liblua53.a) on windows, that's why you get the error. The correct way would be to use the dll and the lua53.lib for windows, and link it dynamically. Theoretically you can link it statically too; I tried but i didn't got the lib from the official source to work with PureBasic.

Here is the include i created about a year ago: https://github.com/Dadido3/Lua-PureBasic
It contains the binaries of 5.3.3 or earlier, but the include should be compatible with the newer dll/lib files. I use utf-8 pseudotypes for all strings, so it will work with unicode. It's fully compatible with unicode characters in function names, strings and all the other stuff. (See http://lua-users.org/wiki/LuaUnicode)

I should probably update the github with the newest lua binaries soon. If there is still a problem just ask.
Thanks for sharing your include! I'm not using the Linux static library though, in the Windows binary download the lib included for linking with the .dll is a .a file. I'll try your include and see how far I get, thanks! I did use Lua in PB quite often, I've never encountered this problem before the Ascii mode was removed.
Image
Bas Groothedde,
Imagine Programming

I live in a philosophical paradoxal randome filled with enigma's!
User avatar
Crusiatus Black
Enthusiast
Enthusiast
Posts: 389
Joined: Mon May 12, 2008 1:25 pm
Location: The Netherlands
Contact:

Re: Binding Lua 5.3.4 to PureBasic 5.51 Application (x64)

Post by Crusiatus Black »

Your include works splendid with the binaries you've included on the repository, thanks for sharing them! Problem solved, 5.3.3 will do fine :)
Image
Bas Groothedde,
Imagine Programming

I live in a philosophical paradoxal randome filled with enigma's!
Post Reply