lua-users home
lua-l archive

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


Could You show symbols being exported from Your "pkghandler.dll" please? :)

It *MIGHT* be a linkage problem.

A bit different approach to building and loading *.DDL's for Lua is
described here:
http://lua-users.org/wiki/CreatingBinaryExtensionModules

(Notes section *MIGHT* be more useful then a bit outdated code example)

On 10/1/13, peter.a.stephens@comcast.net <peter.a.stephens@comcast.net> wrote:
> Guys and Gals,  I am trying to make a couple of stubs for LUA C API lib
> calls,   #define LUA_LIB   #include <lua.h>   #include <lualib.h>   #include
> <lauxlib.h>
>    static int l_pkghandler_decrypt(lua_State * L) {      // return success
>    lua_pushinteger(L, 0);      return 1;   }
>    static int l_pkghandler_verify(lua_State * L) {      // return success
>   lua_pushinteger(L, 0);      return 1;   }
>    static const luaL_Reg pkghandler_funcs[] = {      { "decrypt",
> l_pkghandler_decrypt },      { "verify", l_pkghandler_verify },      { NULL,
> NULL } };
>    LUALIB_API int luaopen_pkghandler(lua_State * const L) {
> luaL_register(L, "pkghandler", pkghandler_funcs);      return 1;   }When I
> try to run it in lua (5.1 from Eclipse) as this,   local function main()
>  package.cpath = "E:\\proj\\pkghandler\\Release\\?.dll;"..package.cpath
> print(package.cpath)      ph = require "pkghandler"   end   main()I get,
> E:\proj\pkghandler\Release\?.dll;.\?.dll;.\?51.dll;E:\programs\jre\bin\?.dll;E:\programs\jre\bin\?51.dll;E:\programs\jre\bin\clibs\?.dll;E:\programs\jre\bin\clibs\?51.dll;E:\programs\jre\bin\loadall.dll;E:\programs\jre\bin\clibs\loadall.dll
>   Exception in thread "main" com.naef.jnlua.LuaRuntimeException: error
> loading module 'pkghandler' from file
> 'E:\proj\pkghandler\Release\pkghandler.dll':          The specified module
> could not be found.          at com.naef.jnlua.LuaState.lua_pcall(Native
> Method)          at com.naef.jnlua.LuaState.call(LuaState.java:555)
> at
> org.eclipse.koneki.ldt.support.lua51.internal.interpreter.JNLua51Launcher.run(JNLua51Launcher.java:122)
>          at
> org.eclipse.koneki.ldt.support.lua51.internal.interpreter.JNLua51Launcher.main(JNLua51Launcher.java:137)Seems
> like it is finding the file, but I don’t know why it cant “find” the
> “module”.  I have compared to several examples online and it looks like it
> is correct.  I am using Cygwin to compile LUA nad my library module on
> Windows.  I tried both the 'mingw' and 'posix' targets when I compile
> 'liblua.a'.  I am running Eclipse (CDT + LDT).I would appreciate any
> pointers.
>  - Pete