Thread: howto make a static library?

  1. #1
    Registered User
    Join Date
    Jul 2002
    Posts
    913

    howto make a static library?

    how do you create a static library, like the standard ones?

    if i have test.c i start with :
    • gcc -c test.c
      ar -cr test.a test.o
      ranlib test.a

    where do i go from there?

    i cant find a stdio.a anywhere, how are the standard ones made?

  2. #2
    Registered User
    Join Date
    Jul 2002
    Posts
    913
    can i combine libraries together?

    right now if i have test1.c and test2.c i run
    Code:
    gcc -c test1.c
    ar -cr libtest1.a test1.o
    ranlib libtest1.a
    
    gcc -c test2.c
    ar -cr libtest2.a test2.o
    ranlib libtest2.a
    
    ld -r -o test.o test1.o test2.o
    ar -cr libtest.a test.o
    ranlib libtest.a
    can i cut out the object files and go right to combining and indexing? how?

  3. #3
    Comment your source code! Lynux-Penguin's Avatar
    Join Date
    Apr 2002
    Posts
    533
    I don't know enough about this to actually help you but its in this book somewhere, I remember skimming over it and noticing a good portion on it.

    Advanced Linux Programming

    Sorry if I can't be of more help.

    And I would like to thank Salem for showing me the link, it has proven useful time and time again.

    -LC
    Asking the right question is sometimes more important than knowing the answer.
    Please read the FAQ
    C Reference Card (A MUST!)
    Pointers and Memory
    The Essentials
    CString lib

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help building/linking to static library
    By Kernel Sanders in forum C++ Programming
    Replies: 19
    Last Post: 08-17-2008, 04:35 PM
  2. Howto make own application for remote control handling
    By s-men in forum Windows Programming
    Replies: 16
    Last Post: 08-16-2008, 04:22 PM
  3. Replies: 19
    Last Post: 01-12-2006, 11:04 AM
  4. Using private class members in static functions
    By sethjackson in forum C++ Programming
    Replies: 2
    Last Post: 09-23-2005, 09:54 AM
  5. opengl program as win API menu item
    By SAMSAM in forum Game Programming
    Replies: 1
    Last Post: 03-03-2003, 07:48 PM