www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/11/22/15:47:59

Date: Wed, 22 Nov 1995 12:50:22 -0500
From: kagel AT quasar DOT bloomberg DOT com
To: matt DOT emmett AT bbs DOT logicnet DOT com
Cc: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Re: Making libraries
Reply-To: kagel AT ts1 DOT bloomberg DOT com

   From: Matt Emmett <matt DOT emmett AT bbs DOT logicnet DOT com>
   Date: 22 Nov 1995 02:58:39 GMT

   Hello,
     I was wondering if it is possible to make a .lib in djgpp 
   v2.0 and include it by useing 

   #include "whatever.h"

   ?

     currently to speed up compile time i just use .o files but 
   they aren't as nice as a .lib in turbo c.  

Yes.  The DJGPP distribution includes the UNIX ar utility which maintains .a
archive files which are the library files used by the DJGPP loader ld.  So, you
can create libraries as below:


gcc -c unit1.c unit2.c unit3.c

ar -r /mylibdir/libunits.a unit1.o unit2.o unit3.o

and use the library as:


gcc -ounitprog unitmain.c -L/mylibdir -lunits

Obviously all of this can be put into makefiles.  BTW: GNU make, also
distributed with DJGPP, knows how to maintain and extract from ar libraries and
how to check time dependencies of object files in a library.

-- 
Art S. Kagel, kagel AT ts1 DOT bloomberg DOT com

The sky is the daily bread of the eyes.  -- Ralph Waldo Emerson

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019