Mail Archives: djgpp/1996/07/13/01:56:53
Reply to message 5898125 from MMHAMZE AT MAIL. on 07/12/96 12:02PM
>I looked into the docs that come with DJGPP ver2, and I can not seem
>to find the command line switches that I should use to link objects
>(or assemble and compile and link) into a libray (not an exe). Can
>someone give an example of the command line switches needed to do
>that.
To create a library under DJGPP, you use the 'ar' function. This is
part of the standard distribution and there's quite comprehensive
online documentation (info Binutils ar). Simply, to create a library,
do the following:
Compile your code into object files (.o) by giving the -c switch to gcc.
Archive the files into a library with the following command:
ar rvs <mylib.a> <object file> <object file> ...
Thereafter, as long as that library is in the current LIBRARY_PATH as
defined in DJGPP.ENV, you can simply link it with -l when you compile
like any other library. You could also specify the directory it's in with
the -L switch.
John
- Raw text -