Skip to main content
gamedev.net
🔒 Locked

Problems with Lua's loadlib

Started by Starfox 1 reply 1.1k views
Original Post
Starfox
Starfox
I have a DLL with a funciton declared with __declspec(dllexport) and extern "C", called foo. when I try typing the following in the Lua interpreter: loadlib('mydll.dll', 'foo')(); I get the following: stdin:1: attempt to call a null value stack traceback: stdin:1: in main chunk [C]: ? What am I doing wrong?
Kylotan
Kylotan
I'd say it's pretty obvious; the loadlib call is failing, so you get a null value, then you treat it as a function. The real question is, why is it failing? Is the DLL is in the program's directory, or your current working directory (if they differ)? Can you get the example at http://lua-users.org/wiki/CreatingBinaryExtensionModules to work?
Starfox
Starfox
Thanks for the link, I was using lua as a static lib not a dll. Thanks again, rating++.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.