Page 1 of 1

can I use other library(dll file) in Lua script?

Posted: Sun Mar 13, 2016 7:55 am
by dkpark89
I made a test.dll with Luabind, but T-engine is crash down.
I tested Lua51.exe, in this case, Lua51.exe did not crash, and very well done my dll.

can I use other library(dll file) in Lua script called by T-engine?

==== source code of test.dll =========
#include <iostream>
#include <luabind/luabind.hpp>
void greet()
{
std::cout << "hello world!\n";
}
extern "C" int __declspec(dllexport) initMyTest(lua_State* L)
{
using namespace luabind;
open(L);
module(L)
[
def("greet", &greet)
];
return 0;
}
=================


and call it in lua script
====== test.lua =====
function myTest()
package.loadlib("test.dll", "initMyTest")() <== crash down
greet()
end
=================

Re: can I use other library(dll file) in Lua script?

Posted: Sun Mar 13, 2016 12:34 pm
by Castler
ToME uses LuaJIT, not Lua 5.1. I don't know if the two are ABI-compatible on Windows, but I don't think they are, so that may be the source of your problem.

Re: can I use other library(dll file) in Lua script?

Posted: Sun Mar 13, 2016 12:54 pm
by dkpark89
Castler wrote:ToME uses LuaJIT, not Lua 5.1. I don't know if the two are ABI-compatible on Windows, but I don't think they are, so that may be the source of your problem.
Thank you, it's very useful help. :D