Re: Loadlib problems (Resolved!!!)
Status: Alpha
Brought to you by:
cwalther
From: Andrea V. <and...@gm...> - 2008-05-21 08:47:52
|
Hello, Christian Thank you for your quicky answer and your tests. It's true, the code that I have posted, wasn't correct.... I have send a wrong version, i'm apologize...: static const luaL_reg mylib[] = { {"getprojectpath", luaGetProjectPath}, //Single function (no methods) {"newgreeter", greeterGreeting}, //Constructor with methods {"greeting", greeting}, //Single function {NULL, NULL} }; util.greeting() correspond to tour greeting() and return just "Hello world!". I have done some investigation on internet, and I have discover that the behaviour I have described is caused by a BUG in the Windows version of lua interpreter: functions in the DLL allocate some memory in the stack of the interpreter. When the script finished, the interpreter will call lua_close(L) to release the resources. But it unload also the dll before clear the stack, so, the memory allocated in the DLL become invalid. Fortunately, this problem occurs only with the debugging versions of the libraries (first of all msvcrtd.lib and libcmtd.lib) Disabling all debug information and linking libraries without debugging info (msvcrt.lib and libcmt.lib) the problem disapear and all works FINE!!! I will put these infos on the wiki, if other people would realize plugins.. Now I want to try with your pipmak.exe.lib. Thank you!! Andrea |