Find the answer to your Linux question:
Results 1 to 3 of 3
To create a static library, or to add additional object files to an existing static library, I can use a command like this: ar rcs my_library.a file1.o file2.o But how ...
  1. #1
    Just Joined!
    Join Date
    Mar 2010
    Posts
    3

    How to add a static library to my own static library

    To create a static library, or to add additional object files to an existing static library, I can use a command like this:

    ar rcs my_library.a file1.o file2.o

    But how to add an existing static library to my own static library.

    I have created my own static library using the command above and want to link against the library libuuid.a (placed in /usr/lib/).

    Can I use ar to add libuuid.a to my_library.a?

  2. #2
    Just Joined! sixdrift's Avatar
    Join Date
    Jan 2007
    Location
    In and around and about Cary, NC
    Posts
    44
    Why not just link against both static libraries? What purpose do you have for including one in another?

  3. #3
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    I usually extract the object files out of the library in question and add them to my library when I need to deliver a single library to users instead of a bunch. This isn't always the best approach, but it does sometimes solve otherwise knotty problems.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...