• Advertisement
Sign in to follow this  

Problems with Lua's loadlib

This topic is 4247 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
Advertisement
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?

Share this post


Link to post
Share on other sites
Thanks for the link, I was using lua as a static lib not a dll. Thanks again, rating++.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement