lua-users home
lua-l archive

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


Hi Claire,

>> Now I just need to do it for Lua 5.2 and LuaJIT... Is there a simpler
>> way to achieve the same result?

> Is there a reason you aren't defining LUA_API to __declspec(dllexport) for your static
> compiled exe?  That would have seemed easiest to me.

I tried that, but couldn't get it to work either. When I use
-DLUA_API=__declspec(dllexport), it's overwritten by #define LUA_API
extern in luaconf.h (so symbols don't get exported). When I use
LUA_BUILD_AS_DLL, which should have the same effect as setting
LUA_API, I get bunch of "undefined reference to `_imp__lua_sethook'"
warnings.

You suggestion made me to review the related code one more time and it
turned out that I also need to set LUA_CORE or LUA_LIB along with
LUA_BUILD_AS_DLL to get LUA_API properly assigned.

Here is the makefile target that works for both Lua 5.1 and Lua 5.2
(you may want to disable redefine warning with -Wp,-w):

"$(MAKE)" "LUA_T=lua.exe" \
"AR=$(AR) -o" "RANLIB=strip --strip-unneeded" \
"MYCFLAGS=-DLUA_CORE -DLUA_BUILD_AS_DLL" lua.exe

Paul.

On Mon, Nov 25, 2013 at 9:26 PM, Claire Lewis <claire_lewis@live.com.au> wrote:
>
>> Now I just need to do it for Lua 5.2 and LuaJIT... Is there a simpler
>> way to achieve the same result?
>
>
> Is there a reason you aren't defining LUA_API to __declspec(dllexport) for
> your static compiled exe?  That would have seemed easiest to me.
>
> - Claire
>
>