Search code examples
dllcygwinmingw32

Merge "o" files into dll with cygwin+mingw32


I've builded *.exe file with cygwin+mingw32:

gcc -g -O2 -o espresso black_white.o canonical.o cofactor.o cols.o compl.o contain.o cpu_time.o cubestr.o c ... e.t.c.

I've learned that I can create dlls from *.o files using --shared command.

But I'm compiling using makefile. What can I do in this case? Can I, somehow, after the 'make' command is executed, take all those *.o files and create dll from them?


Solution

  • sure:

    gcc -shared -O2 -o libespresso.dll *.o
    

    Note that on darwin or unix this is not so easy, as you need to add -fPIC and -fpic to CFLAGS and LDFLAGS.