【发布时间】:2013-03-28 12:23:59
【问题描述】:
我有该死的大问题。如您所知,Lua 允许制作模块,您可以从 5.1(以前的 loadlib)开始使用 require() 函数加载这些模块。
#define LUA extern "C" __declspec(dllexport) int __cdecl
static int l_TestFunc(lua_State * L)
{
lua_pushboolean (L, 1); // return true
return 1;
}
LUA luaopen_MyModule(lua_State *L)
{
printf("test2");
lua_pushcfunction(L, l_TestFunc);
lua_setglobal(L, "TestFunc");
return 1;
}
所以在 Lua 中你只是使用 require("MyModule") 并且一切正常。(luaopen_* 是入口点)
但我需要使用标准方式(DllMain 作为入口点)。我试过了,但没有用。 有什么想法吗?
【问题讨论】:
-
"但我需要使用标准方式(DllMain 作为入口点)。" ...为什么?