# include & lt; iostream>
Extern "C"
{
# include & lt; Lua. H>
# include & lt; Lualib. H>
# include & lt; Lauxlib. H>
}
Static int retStr (lua_State * L)
{
Lua_pushstring (L, "is this DLL return a string");
return 1;
}
The static const luaL_Reg util []={
{" getStr ", retStr},
{NULL NULL}
};
Extern "C" __declspec (dllexport)
Int luaopen_luacalldll (lua_State * L) {
LuaL_newlib (L, util);
return 1;
}
After generating the dynamic library, I in the same directory as the it made a lua files:
The lua file code is as follows:
local obj=the require (" luacalldll ")
Print (obj. GetStr ())
But I can't run the lua files, an error figure below:
Where is my wrong, why my DLL are generated, or can not call it?