DavidColson
DavidColson

Reputation: 8597

Compiling lua scripts into a dll?

I have heard of using LuaJIT to compile Lua code into bytecode and then into a static library.

Ideally I would want to be able to compile the Lua code into a dynamic library so I don't have to rebuild the main executable.

Can you compile Lua into a dll? If so how do you link it to c++ code since there's no headers? Finally how would you run the Lua scripts from inside the program?

Upvotes: 2

Views: 9748

Answers (1)

gmlime
gmlime

Reputation: 1017

I believe what you would do is link the lua interperter dll ( http://www.lua.org/pil/24.html ) to your program and then include the script as a resource such as in a header to your c/c++ program and use the lua.dll functions to execute it. Also you can call lua functions from C using that method( this shows a several complete snippet examples with header files http://www.troubleshooters.com/codecorn/lua/lua_c_calls_lua.htm ) .

Upvotes: 1

Related Questions