Thread: Compile and Link tutorials

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    3,229
    When I link a static library to my code, the object code of that static file is added or copied to my object file. It doesn't matter if the static library is later deleted from my disk. But when I link a shared library, then only a list containing the functions, provided by the shared library, is added to my object file. If I were to delete the shared library, I'd get an error while trying to run the object file.
    Correct.

    Also, if I don't add the -S switch to gcc, it still does generate the assembly code as an intermediate step, doesn't it? It just doesn't write out the file.
    Yeap, -S tells GCC to stop before the assembling phase, and -c tells it to stop after assembling (no linking).

  2. #2
    Registered User
    Join Date
    Jul 2009
    Posts
    9
    Thank you everyone for your replies. It really helped me a lot.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how to compile projects ?
    By manzoor in forum C++ Programming
    Replies: 31
    Last Post: 10-15-2008, 11:52 AM
  2. I need help to compile this code...
    By wise_ron in forum C Programming
    Replies: 17
    Last Post: 05-07-2006, 12:22 PM
  3. Link Error
    By Luigi in forum C++ Programming
    Replies: 1
    Last Post: 04-12-2004, 07:12 PM
  4. .lib vs .h vs .dll
    By Shadow12345 in forum C++ Programming
    Replies: 13
    Last Post: 01-01-2003, 05:29 AM
  5. Red Hat Linux GNU Link Question
    By PieartL in forum Linux Programming
    Replies: 2
    Last Post: 02-28-2002, 12:05 PM