delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/08/04/00:20:05

From: "John M. Aldrich" <fighteer AT cs DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Creating libraries
Date: Wed, 30 Jul 1997 20:27:53 +0000
Organization: Two pounds of chaos and a pinch of salt
Lines: 48
Message-ID: <33DFA3C9.1948@cs.com>
References: <33df509e DOT 6977474 AT news DOT pacific DOT net DOT sg>
Reply-To: fighteer AT cs DOT com
NNTP-Posting-Host: ppp106.cs.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Gary Tan wrote:
> 
> Hi,
>         can someone pls enlighten me on how to create a library
> ("lib*.a") file??? I've read the readme.1st and faq, but can't seem to
> find any clues?

Libraries are constructed with the 'ar.exe' program.  You can look up
the details in the docs, but the basic syntax to create a library is
thus:

  ar rvs libmylib.a file1.o file2.o file3.o file4.o [...]

The 'rvs' flags tell ar to 1) create or replace files in the library
('r'), 2) give details as to what it's doing ('v'), and 3) build a
symbol table for the library ('s').  The second argument is the name of
the library and the rest of the arguments specify files to add. 
Wildcards are acceptable.

>         btw, is copying a library from the UNIX system library dir. to
> My DJGPP\lib okay? I mean is the library cross-platform?

Libraries are never cross-platform, as they represent object code
compiled for a particular machine architecture.  You must find the
source for this library, port it to MS-DOS, and rebuild it.

>         also. If I create a class called Chi_Array, can I use Array
> instead after I
> 
> typedef Chi_Array Array;

Certainly.  A typedef makes the new type exactly equivalent to its
definition.  Examples:

typedef struct junk	JUNK;
JUNK data;   /* = struct junk data; */

typedef JUNK[100]	BIGLIST;
BIGLIST list, list2;   /* struct junk list[100], list2[100]; */

hth!

-- 
---------------------------------------------------------------------
| John M. Aldrich, aka Fighteer I |     mailto:fighteer AT cs DOT com      |
| Proud owner of what might one   |   http://www.cs.com/fighteer    |
| day be a spectacular MUD...     | Plan: To make Bill Gates suffer |
---------------------------------------------------------------------

- Raw text -


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