delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/12/14/21:34:12

From: "Tony O'Bryan" <aho450s AT nic DOT smsu DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Library Problem ! Help !
Date: Sun, 14 Dec 1997 18:34:54 -0600
Organization: Southwest Missouri State University
Lines: 20
Message-ID: <34947B2E.42B6@nic.smsu.edu>
References: <66v8v3$8s2$1 AT duke DOT telepac DOT pt> <349453EA DOT 35A25A78 AT spam DOT me>
Reply-To: aho450s AT nic DOT smsu DOT edu
NNTP-Posting-Host: clark.a46.smsu.edu
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Ryan McGee wrote:

> Your actual functions should go into a .c file.  To make a library,
> you need to compile your .c code into an .obj and run ar to make a
> .lib(you can find the help for ar in INFO) you then can compile with
> the comand gcc myfile.c -l mylib.lib and it will only include the
> functions you use from your lib.

	You have the idea right, but some of the details were incorrect.  DJGPP
libraries don't combine to form a library with the extension "LIB". 
They combine to form a library of the form "lib[name].a", where [name]
is the name of the library.  The Allegro library, for example, is named
"liballeg.a".  To tell the linker to link Allegro into a program with a
single C source file named "myfile.c" (assuming all paths are already
and correctly set), use the gcc command:

gcc myfile.c -lalleg

Hopefully I haven't overlooked anything, or this thread will continue to
expand with corrections. -grin-

- Raw text -


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