lua-users home
lua-l archive

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


----- Original Message ----- From: "nusret" <nbalci_l@yahoo.com>
To: <lua@bazar2.conectiva.com.br>
Sent: Sunday, February 12, 2006 2:24 PM
Subject: luac and import library for dll are not built (mingw)

You probably know that, but if you add

#if defined(__CYGWIN__) || defined(__MINGW32__)
#undef LUA_API
#undef LUALIB_API
#undef LUAI_FUNC
#undef LUAI_DATA
#define LUA_API extern
#define LUALIB_API extern
#define LUAI_FUNC extern
#define LUAI_DATA extern
#endif

to the Local configuration section at the end of luaconf.h

and then modifying the Makefile in src directory

clean:
$(RM) $(ALL_T) $(ALL_O) lua.exe luac.exe lua51.dll liblua51.dll.a liblua51.a

...

mingw: lua51.dll
# gcc -O2 -Wall -Wl,--enable-auto-import lua.c -o lua.exe -s lua51.dll
# gcc -O2 -Wall -Wl,--enable-auto-import luac.c print.c -o luac.exe -s lua51.dll
gcc -O2 -Wall -L. -Wl,--enable-auto-import lua.c -o lua.exe -s -llua51.dll
gcc -O2 -Wall -L. -Wl,--enable-auto-import luac.c print.c -o luac.exe -s -llua51.dll

lua51.dll: $(CORE_O) $(LIB_O)
gcc $(CFLAGS) -DLUA_BUILD_AS_DLL $(CORE_O) $(LIB_O) \
   -Wl,--out-implib=liblua51.dll.a -shared -o lua51.dll -lm
strip --strip-unneeded lua51.dll


you will be able to build
lua.exe and luac.exe by linking against the .dll or
the import lib.

I tried it, and it works both under Mingw32/Msys
and CygWin.

In both cases, the command: make mingw
build everything Ok.

The command is executed und the WinXP cmd.exe shell.
(Of course PATH has been SET ok)

Carlos