From: AndrewJ Newsgroups: comp.os.msdos.djgpp Subject: Re: Did someone write LIBRARY in DJGPP ? Message-ID: References: <8q8ld8$iik$1 AT info DOT cyf-kr DOT edu DOT pl> X-Newsreader: Forte Agent 1.7/32.534 MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Lines: 52 Date: Tue, 19 Sep 2000 23:20:06 GMT NNTP-Posting-Host: 24.42.120.18 X-Complaints-To: abuse AT home DOT net X-Trace: news3.rdc1.on.home.com 969405606 24.42.120.18 (Tue, 19 Sep 2000 16:20:06 PDT) NNTP-Posting-Date: Tue, 19 Sep 2000 16:20:06 PDT Organization: Excite AT Home - The Leader in Broadband To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com On Tue, 19 Sep 2000 23:17:50 +0200, "Rafał Maj" wrote: >Hi, >If You have ever written any library in DJGPP, than can You help me ? > >I know that I can use 'ar' program for making library, but real *hate* > to read docs... This isn't very likely to get you an answer (I'm feeling kindly right now). The typical flow for answering a question should be: 1) check info for information 2) check the FAQ 3) re-check the FAQ 4) do 1, 2 and 3 each one more time 5) post here :) >...and my question is really very simple. >I have following files : [snip] >1) How can I step-by-step convert lib.cc into library, so everytime I'll >compile prg.cc, DJGPP will not re-compile lib.cc, but only link my program >with lib.o (or lib.a, or whatever) Compile lib.cc as you usually would, but use the '-c' switch to inform the compiler to only compile, not link. Then, execute the command: ar rcs mylib.a lib.o The 'r' option inserts the files specified, with replacement. The 'c' option creates the archive if it doesn't exist. The 's' option writes an object-file index into the archive. Or try 'info ar'. It's easy. C'mon, you can do it. Also, I recommend against using the name 'lib' for your library. It may create conflicts in the future. >2) I should #Include files used by my library only in lib.cc ? Unless they contain information that is also needed by other programs. As an aside note, it's rather foolish to create a library which only contains two rather trivial functions. If you want to build your programs so that only the files you have changed are updated, consider looking into the "make" utility. (Here we go... 'info make'). -- AndrewJ