lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


>From lua-l@tecgraf.puc-rio.br  Tue Jul 11 04:24:11 2000
>From: "chagbinary" <chagbinary@email.com>

[Please, do not post HTML. Thanks.]

>i just cant figure out how to initalize Lua 3.2 or 4.0.
>
>the statement
>    "lua_State *L = lua_newstate(NULL);"
>brings about
>    "unresolved external symbol "struct lua_State * __cdecl
>lua_newstate(char const *,...)""
>
>when it reaches the linker.

In 3.2, you use lua_open. In 4.0, you can use lua_open too.
If you want the new, multiple-state API, then you call lua_newstate but you
have to #define LUA_REENTRANT before #include "lua.h".

>also, does anyone have a Lua 4.0 DLL?  (MSVC 6)

We don't, but here is a script to creata .def from lua.h:

-- def.lua
-- make .DEF file from lua.h
-- usage: lua def.lua <lua.h >lua.def

T=read"*a"
write("LIBRARY LUA\nVERSION ")
gsub(T,"LUA_VERSION.-(%d+%.%d+)",write)
write("\nEXPORTS\n")
gsub(T,"(lua_%w+)%s+%(",function (f) write("   ",f,"\n") end)

Here is a script to add __stdcall if you need it.

-- stdcall.lua
-- add __stdcall where appropriate
-- usage: lua stdcall.lua <lua.h >s_lua.h
-- usage: lua stdcall.lua <lapi.c >s_lapi.c

T=read"*a"
T=gsub(T,"(lua_%w+%s+%()","__stdcall %1")
T=gsub(T,"(%*lua_CFunction)","__stdcall %1")

write(T)
--lhf