www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/08/02/23:39:38

Message-Id: <199808030339.EAA31459@sable.ox.ac.uk>
Comments: Authenticated sender is <mert0407 AT sable DOT ox DOT ac DOT uk>
From: George Foot <george DOT foot AT merton DOT oxford DOT ac DOT uk>
To: Goh Yong Kwang <s6606555 AT mercury DOT np DOT ac DOT sg>
Date: Mon, 3 Aug 1998 04:38:22 +0000
MIME-Version: 1.0
Subject: Re: How to create a library?
Reply-to: george DOT foot AT merton DOT oxford DOT ac DOT uk
CC: djgpp AT delorie DOT com

On  3 Aug 98 at 9:57, Goh Yong Kwang wrote:

> I want to create a library but is not quite sure how to do it.
> 
> I think that the first step would be to compile all the c/c++ file into 
> object file (.o). Then from there, use the ar utility with the -r switch 
> to add all the .o files to the library. Then copy the library archive 
> (.a) to djgpp/lib directory. (This is the easiest step. Otherwise I'll 
> have to fiddle with the djgpp.env file to tell djgpp where to look for my 
> library).
> 
> Is the procedure correct? Please correct me if I'm wrong.

This procedure should work.  Doesn't it?

You forgot to mention creating one or more header files for the 
library though.  It's not essential, but if you don't do this then 
the implicit declarations could fail to match the real functions, or 
the user could misprototype them.  Similarly, variables' types may be 
muddled by the user's incorrect declarations.

-- 
george DOT foot AT merton DOT oxford DOT ac DOT uk

- Raw text -


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