lua-users home
lua-l archive

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

I was trying to compile Lua 5 as DLLs with MinGW (from 
Dev-C++) to be used in Delphi and C.
The main issues were:
- Windows XP shell, which was unable to execute the 
- Discover the precise options I would need (hunt 
makefiles, config, build and the wiki)
- I wanted to learn how to do it by hand, without 

Finally I compiled Lua as follows. If anyone spots an 
error, please tell me. So far, it seems to work. I guess 
I should put it on the wiki if it's correct.

set CFLAGS=-O2 -Wall -
DLUA_USER_H="\"../etc/luser_number.h\"" -DUSE_FASTROUND

cd src

gcc %CFLAGS% -I..\include -c *.c

cd lib

set PIPE=-DUSE_POPEN=1 -Dpopen=_popen -Dpclose=_pclose

gcc %CFLAGS% %PIPE% -I..\..\include -c *.c

cd ..\..

gcc -shared -Wl,--export-all-symbols -o bin\lua-5.0.dll 

gcc -shared -Wl,--export-all-symbols -o bin\lualib-
5.0.dll src\lib\*.o bin\lua-5.0.dll

gcc %CFLAGS% -o bin\lua.exe -Iinclude -D_POSIX_SOURCE 
src\lua\lua.c bin\lualib-5.0.dll bin\lua-5.0.dll

gcc %CFLAGS% -o src\luac\lopcodes.o -Iinclude -
DLUA_OPNAMES -c src\lopcodes.c

gcc %CFLAGS% -o bin\luac.exe -Iinclude -Isrc 
src\luac\luac.c src\luac\print.c src\luac\lopcodes.o 
bin\lualib-5.0.dll bin\lua-5.0.dll

The examples I found on the wiki were much more complex, 
I feel I may be missing something...

Seleção de Softwares UOL.
10 softwares escolhidos pelo UOL para você e sua família.