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

Moderator: Moderator

Post Reply
Message
Author
dkpark89
Posts: 2
Joined: Sun Mar 13, 2016 7:42 am

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

#1 Post 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
=================

Castler
Thalore
Posts: 153
Joined: Mon Mar 25, 2013 10:09 pm

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

#2 Post 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.
Qi Daozei (QDZ) - an Oriental-themed fantasy game for T-Engine. ToME Tips - auto-generated spoilers for ToME.

dkpark89
Posts: 2
Joined: Sun Mar 13, 2016 7:42 am

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

#3 Post 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

Post Reply