[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Lua
. . -> [Subject]  Issues using a lua C-package

Issues using a lua C-package

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Posted by Mr.lundmark   (51 posts)  [Biography] bio
Date Tue 31 Oct 2023 06:14 AM (UTC)
Message
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
[Go to top] top

Posted by Mr.lundmark   (51 posts)  [Biography] bio
Date Reply #1 on Tue 31 Oct 2023 06:32 AM (UTC)
Message
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!
[Go to top] top

Posted by Fiendish   USA  (2,519 posts)  [Biography] bio   Global Moderator
Date Reply #2 on Tue 31 Oct 2023 02:54 PM (UTC)
Message
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?

https://github.com/fiendish/aardwolfclientpackage
[Go to top] top

Posted by Mr.lundmark   (51 posts)  [Biography] bio
Date Reply #3 on Tue 31 Oct 2023 04:55 PM (UTC)
Message
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
[Go to top] top

Posted by Fiendish   USA  (2,519 posts)  [Biography] bio   Global Moderator
Date Reply #4 on Wed 01 Nov 2023 06:34 PM (UTC)
Message
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

https://github.com/fiendish/aardwolfclientpackage
[Go to top] top

Posted by Mr.lundmark   (51 posts)  [Biography] bio
Date Reply #5 on Thu 02 Nov 2023 06:27 AM (UTC)
Message
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?
[Go to top] top

Posted by Fiendish   USA  (2,519 posts)  [Biography] bio   Global Moderator
Date Reply #6 on Thu 02 Nov 2023 02:35 PM (UTC)
Message
It's a drop-in replacement, since it's fully binary compatible with the 5.1 interface.

https://github.com/fiendish/aardwolfclientpackage
[Go to top] top

Posted by Mr.lundmark   (51 posts)  [Biography] bio
Date Reply #7 on Sat 04 Nov 2023 11:30 AM (UTC)
Message
Ah my bad, I thought that luajit 2.x was only Lua 5.2 compatible. Thanks!
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


2,499 views.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]