推的C函数我有该死的大问题。如你所知,Lua允许创建模块,并且你可以用5.1(以前的loadlib)中的require()函数加载这些模块。的Lua模块从DllMain的
#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作为入口点)。”* ...为什么? – 2013-04-06 01:30:54