delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/07/20/18:32:54

Xref: news2.mv.net comp.os.msdos.djgpp:6197
From: brennan AT mack DOT rt66 DOT com (Brennan "Reverend Bas" Underwood)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: How do I create my own libraries ?
Date: 19 Jul 1996 11:20:16 -0600
Organization: None, eh?
Lines: 29
Message-ID: <4sog4g$9g3@mack.rt66.com>
References: <jnt7xg8CV84b091yn AT sn DOT no>
NNTP-Posting-Host: mack.rt66.com
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

In article <jnt7xg8CV84b091yn AT sn DOT no>, Arne Knut Roev <akroev AT sn DOT no> wrote:
>No, I am not working on a new libc. I am simply writing a number of
>more or less useless ;-) functions, and I would like to add them to
>a library of my own.
>
>How do I do this, using djgpp ver. 2.0 ?

Look at ar.
ar sru libmine.a this.o that.o theother.o
will do.
Do:
ranlib libmine.a
if it's linking slowly.

> ( And, while we are at it, how do I use the library, once I have
>   created it ?)

On the link step, put -Ldirectory so ld can find it, like -L. if it's in
the local dir, and do -lmine (assumes it's called libmine.a)

You could just put libmine.a on the link line, but then the whole thing
will be linked in no matter what. Using the -l flag ensures that
only the .o files referenced are linked in.
Put the -l entry last, after the .o files.


--Brennan
-- 
brennan AT rt66 DOT com  |  fsck /u

- Raw text -


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