How to create lib files

Degski degski at
Thu Jul 6 12:10:10 CEST 2006

>From SWI-Prolog Windows (gmp) build instructions (,
the part that relates to alloca:


Now  you  have  a  static  version   of    the   library  for  MinGW  in
.libs/libgmp.a. Only, this uses alloca() which  is provided by libgcc.a.
We want alloca() as it is faster and avoids memory fragmentation. So:

	* Find libgcc.a using
		% gcc -print-libgcc-file-name
	* Find the file defining alloca() using the command below.
	  For me this was _chkstk.o.  Guess that is pretty stable.
		% nm -o `gcc -print-libgcc-file-name` | grep alloca
	* Now merg _chkstk.o into our library:
		% ar x `gcc -print-libgcc-file-name` _chkstk.o
		% cp .libs/libgmp.a gmp.a
		% ar q gmp.a _chkstk.o
		% ranlib gmp.a
		% mv gmp.a gmp.lib

Done!  You can use gmp.h and gmp.lib in an MSVC project.

End Quote.

This completes the info provided earlier.

More information about the gmp-discuss mailing list