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: NNTP-Posting-Host: mack.rt66.com To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp In article , Arne Knut Roev 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