This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Using static library
- From: "Andrea 'fwyzard' Bocci" <fwyzard at inwind dot it>
- To: "Wojtek DHAS" <w dot wasikiewicz at dupont dot coatings dot pl>
- Cc: <gcc-help at gcc dot gnu dot org>
- Date: Tue, 10 Dec 2002 17:30:06 +0100
- Subject: Re: Using static library
At 19.26 09/12/2002 +0100, Wojtek DHAS wrote:
Hi,
I have probably very easy question. I have some static windows library
(file.a)
Curious. I thought windows libraries were .lib files.
and I would like to use some function from it. How to call function
from static lib ?
Le's say you need to link agains libfile.a :
1.) Put the library in the linekr search path (see gcc / binutils manual
for this)
2.) #include the relevant "file.h" in your sources
3.) link with the library passing "-lfile" (the same name as the library
minus the initial "lib") to gcc.
Eg., to link against libiberty.a:
1.) have libiberty.a installed somewhere
2.) #include "libiberty.h"
3.) link with "gcc mfiles.o -liberty -o executable_name"
HTH, fwyzard