From: peuha AT cc DOT helsinki DOT fi (Esa A E Peuha) Newsgroups: comp.os.msdos.djgpp Subject: Re: How do I do libraries? Date: 28 Feb 1997 10:04:22 GMT Organization: University of Helsinki Lines: 20 Message-ID: <5f6aj6$8ji@oravannahka.Helsinki.FI> References: <330e5c95 DOT 8824140 AT news DOT demon DOT co DOT uk> Reply-To: Esa DOT Peuha AT helsinki DOT fi NNTP-Posting-Host: kruuna-ether.helsinki.fi Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Sam. (sam AT greenaum DOT demon DOT co DOT uk) wrote: : How do I do libraries in DJGPP? I managed to get GCC to compile some C : into an .O file, but that's as far as I got. I read some of the dox : for ld, but to be honest I don't even know that's what I should be : using. Basically I don't have a clue, somebody please explain how to : get from C source -> .h file and a library to link. If you want to make a library, you should already have the .h file, which you then #include in your source file(s). The .h file is the place to put your funtion prototypes, variable and structure definitions, and so on. Then, after compiling your library sources to object file(s), you use ar (see docs for binutils) to compress the .o file(s) to a single file called libMYLIB.a (MYLIB stands for the name of your library). To link it into your program, add -lMYLIB at the end of your compiling/linking command. -- Esa Peuha student of mathematics at the University of Helsinki http://www.helsinki.fi/~peuha/