Creating libraries of object module

Creating libraries of object module

Post by steven saro » Mon, 26 Feb 1990 06:45:08



How does one create personal libraries or archives of object modules to
like to.  I want to have a library of various useful sub program, and
just link to them with a -l or something akin to it when I am compiling
some larger code.


Thinking Machines Corporation           (_)_____o
245 First St                     ~~~~~~~~~(_____)~~~~~~~~~~~~~~~~~~~~
Cambridge, MA 02142                        oo oo  The Bear who Swims

 
 
 

Creating libraries of object module

Post by Doug Gw » Mon, 26 Feb 1990 07:54:21



>How does one create personal libraries or archives of object modules to
>like to.  I want to have a library of various useful sub program, and
>just link to them with a -l or something akin to it when I am compiling
>some larger code.

All that the "ld" or "cc" option "-lxxx" option does is to in effect
expand in-line to the pathname /usr/lib/libxxx.a.  You can always
specify the pathname of any library archive that you wish to be
searched at that point in the link-editing process.  Such archives
are created and maintained via the "ar" utility, which is described
in the UNIX Programmer's Reference Manual.

For example,
        cc -o foo foo.o foosubs.o mylib.a -lm

 
 
 

Creating libraries of object module

Post by Gordon C. Galligh » Sun, 04 Mar 1990 04:37:28




>>How does one create personal libraries or archives of object modules to
>>like to.  I want to have a library of various useful sub program, and
>>just link to them with a -l or something akin to it when I am compiling
>>some larger code.

>All that the "ld" or "cc" option "-lxxx" option does is to in effect
>expand in-line to the pathname /usr/lib/libxxx.a.  You can always
>specify the pathname of any library archive that you wish to be
>searched at that point in the link-editing process.  Such archives
>are created and maintained via the "ar" utility, which is described

Doug is absolutely correct about the 'ar' utility.  Another thing which he
didn't mention about the -l flag is the ability to use the -L_path_ flag.
This flag, when given, causes the loader (ld(1)) to search that directory
for libraries of the form libxxxx.a also.  This gives you the ability to
have a directory of libraries ($HOME/lib for example) and then on your cc
or ld command lines just give:
         cc -o file .o_files -L$HOME/lib -lm -lmylib1 -lmylib2
Just another way to do the exact same thing.  This gives you a shortcut if
you happen to have more than one "local" library you will be using.

                -- Gordon.


Telxon Corporation   <|> "I am attempting, ma'am, to make a mnemonic memory
Akron, Ohio, 44313   <|> circuit out of stone knives and bearskins"  - Spock
(216) 867-3700 (3512)<|>  _City on the Edge of Forever_

 
 
 

Creating libraries of object module

Post by Doug Gw » Mon, 05 Mar 1990 09:45:49



Quote:>Another thing which he didn't mention about the -l flag is the ability
>to use the -L_path_ flag.

I didn't mention it because it's not always available.  If you know the
pathnames for your libraries, you can always supply the full pathnames
instead of using the -l facility (with or without the aid of -L).
 
 
 

1. How do I create a shared object from a library archive?

Hi,

I'm trying to convert a library archive (.a file) into a sharable
object file (.so). How do I do this?

Any help or suggestions would be great!!
Thanks,
Jayen.
--
=======================================================================
                            Jayen Malde

=======================================================================

2. Security Vulnerability with PMTU strategy

3. How do I create a shared object library

4. XFree 3.3.2 bug with S3V-chips

5. G++ woes creating objects for shared library

6. Apache: Value of ErrorLog directive via mod_perl

7. creating shared objects from .a libraries

8. Image browsers for Linux?

9. How to create a shared object library (lib??.so.??)

10. creating new shared object from existing shared objects ??

11. Attempt to migrate a.out objects (Motif static library) to ELF objects

12. how to create a library (.a) which has another library inside?

13. install halts: "cannot create /modules/modules.cgz..."