lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


if you use c++ , you need

#ifdef __cplus_plus
extern "C" {
#endif

#include "lua.h"
int luaopen_console (lua_State *L);

#ifdef __cplus_plus
}
#endif

int luaopen_console (lua_State *L) { return 0; }


and you may need .DEF file

EXPORTS
luaopen_console








Shmuel Zeigerman escribió:
> After creating a library named console.dll, I encountered a problem
> that was discussed once on the list (see thread [1]).
>
> The source file for my console.dll is:
>> #include "lua.h"
>> int luaopen_console (lua_State *L) { return 0; }
>
> I run
>> lua -lconsole
> from the directory, where console.dll resides, and get the following:
>
>> lua: error loading module 'console' from file './console.dll':
>>     The specified procedure could not be found.
>>
>>
>> stack traceback:
>>     [C]: ?
>>     [C]: ?
>>     [C]: ?
>
> According to the message, Lua fails to find the procedure in
> './console.dll', but that is not true, as in fact it fails on
> C:\Windows\system32\console.dll (see [1]).
>
> BTW, my package.cpath begins with "./?.dll;"
>
> So it seems that even if the problem itself is hard to resolve, then
> at least the error message should be corrected, since it is misleading.
>
> [1] http://lua-users.org/lists/lua-l/2006-12/threads.html#00047
>