Re: require dll
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: require dll
- From: Wim Langers <wim.langers@...>
- Date: 2009年4月17日 14:15:26 +0200
Thanks that did the trick ,
That is, after I also changed the case in the require statement (apparently case sensitive).
So for the record :
C extension as a DLL
_Xx.c
...
static const luaL_reg _Xx[] = ...
...
__declspec(dllexport) int luaopen__Xx (lua_State *L)
{
luaL_openLib(L,"_Xx",_Xx,0);
return 1;
}
compile to _Xx.dll
in Lua script
...
require("_Xx")
...
Wim
On Fri, Apr 17, 2009 at 12:01 PM, Michael Bauroth
<Michael.Bauroth@falcom.de> wrote:
I know ... but you use
_IupRobot.dll' with a 'luaopen__IupRobotLib
instead of
_IupRobot.dll' with a 'luaopen__IupRobot
and require "_IupRobot"
Regards
Michael
Wim Langers schrieb:
Michael : I am working with the two underscores (just tried with one to make sure), but thanks for confirming.
Petr : I do use __declspec (otherwise it wouldn't even work with package.loadlib ? I suppose ?)
Wim
On Fri, Apr 17, 2009 at 10:36 AM, Petr Štetiar <ynezz@true.cz <mailto:ynezz@true.cz>> wrote:
Wim Langers <wim.langers@adrias.biz <mailto:wim.langers@adrias.biz>>
[2009年04月17日 09:51:37]:
> I wrote a C extension to Lua and can load it with 'package.loadlib'.
> I somehow thought that I could load it with require (and not hardcode
> paths). Require finds my dll but then complains that it can't
find 'The
> specified procedure' ?
> Looked all over the place to find out what's going on, but no
success.
> I also read something about naming conventions : I named the dll
> '_IupRobot.dll' with a 'luaopen__IupRobotLib' (two underscores)
and the
> corresponding lua code 'IupRobot.lua'. Also tried with
'luaopen_IupRobotLib'
> (one underscore) because I read something about automatically
removing the
> extra underscore.
Don't forget, that on Windows luaopen_* function should be exported
either using
"__declspec(dllexport)" or using .def file. Try to declare your
function like
something like this "__declspec(dllexport) int
luaopen__IupRobotLib(lua_State *L)".
--ynezz