lua-users home
lua-l archive

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


Alex Queiroz wrote:
     I am trying to build dynamic modules under MinGW using the
instructions at http://lua-users.org/wiki/BuildingModules. So far so
good, but every module built is about 1MB! I thought that linking
against lua51.dll would not copy the whole contents of that file into
the modules.

See below the makefile for MinGW, autogenerated by Dev-C++.
It builds LuaFileSystem dll (lfs.dll).
The resulting DLL size is 28 KB.


# Project: lfs
# Makefile created by Dev-C++ 4.9.9.2

CPP  = g++.exe
CC   = gcc.exe
WINDRES = windres.exe
RES  =
OBJ  = ./lfs.o $(RES)
LINKOBJ  = ./lfs.o $(RES)
LIBS = -L"C:/DEV-CPP/lib" --no-export-all-symbols /progr/lib/lua/lua_5.1/liblua51.a
INCS =  -I"C:/DEV-CPP/include"  -I"/progr/lib/lua/lua_5.1"
CXXINCS = -I"C:/DEV-CPP/lib/gcc/mingw32/3.4.2/include" -I"C:/DEV-CPP/include/c++/3.4.2/backward" -I"C:/DEV-CPP/include/c++/3.4.2/mingw32" -I"C:/DEV-CPP/include/c++/3.4.2" -I"C:/DEV-CPP/include" -I"/progr/lib/lua/lua_5.1"
BIN  = lfs.dll
CXXFLAGS = $(CXXINCS)
CFLAGS = $(INCS) -DLFS_LIB_API=__declspec(dllexport)
RM = rm -f

.PHONY: all all-before all-after clean clean-custom

all: all-before lfs.dll all-after


clean: clean-custom
	${RM} $(OBJ) $(BIN)

DLLWRAP=dllwrap.exe
DEFFILE=liblfs.def
STATICLIB=liblfs.a

$(BIN): $(LINKOBJ)
$(DLLWRAP) --output-def $(DEFFILE) --implib $(STATICLIB) $(LINKOBJ) $(LIBS) -o $(BIN)

./lfs.o: lfs.c
	$(CC) -c lfs.c -o ./lfs.o $(CFLAGS)