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