From: "John M. Aldrich" Newsgroups: comp.os.msdos.djgpp Subject: Re: How can I compile libraries ? Date: Fri, 08 Nov 1996 21:24:41 -0800 Organization: Three pounds of chaos and a pinch of salt Lines: 37 Message-ID: <32841599.7B1D@cs.com> References: <55vc0q$abs_001 AT tuwien DOT ac DOT at> Reply-To: fighteer AT cs DOT com NNTP-Posting-Host: ppp219.cs.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: godzilla To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp godzilla wrote: > > Hi everyone ! > I hope my question isn't too stupid, but how can i compile a library ? > one more question: where can i find information about makefiles (or GNU-make > and what it does) ? Use the 'ar' program, documented in the DJGPP info docs. Basically, compile your code into object (.o) files, use 'ar' to turn them into a library, and then link the library when you compile your programs. Example: gcc -c myfunc1.c myfunc2.c myfunc3.c myfunc4.c ar rvs libmylib.a myfunc1.o myfunc2.o myfunc3.o myfunc4.o gcc -o myprog.exe myprog.c -lmylib As for makefiles, the best way to learn is to get Make (in v2gnu/mak375b.zip), and use it with a program that already has a makefile. Watch what the output is, then look at the makefile to see why it does what it does. Refer to the make documentation that comes with the distribution to look up critical concepts - the docs are very well written. If you like, I can send you an example makefile to build a project, together with comments on what each part is for. P.S.: To read the documentation, you must have installed the v2gnu/txi390b.zip package which contains the 'info.exe' hypertext documentation viewer. -- --------------------------------------------------------------------- | John M. Aldrich, aka Fighteer I | fighteer AT cs DOT com | | * Proud user of DJGPP! * | http://www.cs.com/fighteer | | ObJoke: If Bill Gates were a robber, not only would he | | shoot you, but he'd send you a bill for the bullets. | ---------------------------------------------------------------------