delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/03/05/17:35:42

Date: Wed, 5 Mar 1997 15:16:29 -0700 (MST)
From: David May <dmay AT tvi DOT cc DOT nm DOT us>
To: J <j AT comports DOT com>
cc: djgpp AT delorie DOT com
Subject: Re: compiling libraries...
In-Reply-To: <331DBAB2.F7F@comports.com>
Message-ID: <Pine.SOL.3.95.970305151018.12698F-100000@curie.tvi.cc.nm.us>
MIME-Version: 1.0

On Wed, 5 Mar 1997, J wrote:

> how do I compile libraries in DOS using djgpp? What should I get as
> output files?
> 
> I have no clue on this topic....I just switched over (kind of) from
> programming in UNIX, and I really want to be able to use the same
> libraries I used in UNIX. 
> 
> Um....I am using EZ-GCC if that makes any difference...
> 

EZ-GCC is a toned-down version of DJGPP, is it not?  I mean, it is the
same compiler (v.1.12m??) with a smaller set of support tools, isn't it?
If it is, you create a library by compiling the .c files to .o (using a -c
switch) like so:

  gcc -O3 -o whatever.o -c whatever.c

and then put all the .o files into a lib*.a file using ar, like so:

  ar -rvc libwhat.a whatever.o what1.o...

and, voila! you have a library.  You would link it into an .exe with a
command like:

  gcc -O3 -o which.exe -Lc:/whatever/lib which.c -lwhat

The -L switch tells gcc where to find the library files.

Hope this helps.

David May
ID Card Adminstrator
Albuquerque TVI

- Raw text -


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