console.dll

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

console.dll

Shmuel Zeigerman
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

--
Shmuel
Reply | Threaded
Open this post in threaded view
|

Re: console.dll

David Burgess-3
If you set the package.cpath to !\\?.lua (or someyhing similar) which I
had previously argued should be the default then there would be no problem.
d burgess

Shmuel Zeigerman wrote:

> 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
>
Reply | Threaded
Open this post in threaded view
|

Re: console.dll

Fabian Peña
In reply to this post by Shmuel Zeigerman
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
>