Issues using a lua C-package

Posted by Mr.lundmark on Tue 31 Oct 2023 06:14 AM — 8 posts, 17,371 views.

#0
Hey all,

I'm trying to build a c made lua-package that I want to use in one of my plugins. It's basically a thin wrapper over curl by using the one that ships with windows today.

I've gone through some of the problems, like building x64 instead of x86. Now I've managed to get so far that I'm getting the "The specified procedure could not be found". I've gone through a dependency checker, and everything seems fine. Except for crt/kernel/vcruntime it only links to lua5.1.dll and the three symbols there (luaL_checklstring, luaL_register and lua_createtable) which it seems to find all three of.

I'm linking to a prebuilt 5.1.4 available here: https://sourceforge.net/projects/luabinaries/files/5.1.4/Windows%20Libraries/.

Should I go for luajit instead and use FFI? I was thinking that maybe I could share this module/plugin if I get it working as it seems like a simpler way than the way I've seen other people do here to get curl working.

Thanks for any ideas, suggestion or help :)

Cheers,
Simon
#1
Ok sorry for taking up your time.

My error was that I wasn't expecting to use the package.loadlib with the function that initializes the library. (in my case, the c-function name that initializes the library).

It's solved now :) Many thanks!
USA Global Moderator #2
Quote:
I'm linking to a prebuilt 5.1.4 available here: https://sourceforge.net/projects/luabinaries/files/5.1.4/Windows%20Libraries/

Why not link against the DLL installed with MUSHclient?
#3
Fiendish said:

Quote:
I'm linking to a prebuilt 5.1.4 available here: https://sourceforge.net/projects/luabinaries/files/5.1.4/Windows%20Libraries/

Why not link against the DLL installed with MUSHclient?


It's a lot easier if you have a stub to link to, that way you get less hassle with finding the symbols needed. My dll does link against the dll installed with mushclient.

I tried to say so by mentioning "it only links to lua5.1.dll and the three symbols there (luaL_checklstring, luaL_register and lua_createtable)", hope that helps understand how I did it :)

Best,
Simon
USA Global Moderator #4
I see. I use a stub too because the luajit ecosystem tends to want to see a different dll name https://github.com/fiendish/aardwolfclientpackage/blob/MUSHclient/MUSHclient/lua5.1.dll
#5
Ahh thanks! Yeah I have considered swapping to LuaJIT, I mean the FFI interface is also quite nice iirc. How well have you found it working with mushclient?
USA Global Moderator #6
It's a drop-in replacement, since it's fully binary compatible with the 5.1 interface.
#7
Ah my bad, I thought that luajit 2.x was only Lua 5.2 compatible. Thanks!