2

There are these questions which I am not able to get answers for. Any help is very useful.

  1. How does linking actually happen in the C compilation model?
  2. If I am using Linux and GCC, how does glibc link to the main program. Is it static or dynamic linking?
ArjunShankar
  • 23,020
  • 5
  • 61
  • 83
Shash
  • 4,160
  • 8
  • 43
  • 67

1 Answers1

3
  1. For your first question a simple one para answer is not sufficient. Read the following resources

    1. Article on linking at cprogramming.com

    2. Wikipedia article

    3. man page of ld

    4. SO Post

  2. glibc is linked dynamically unless you specify -static option to the linker. Under normal circumstances, linking a huge lib like glibc statically doesn't help.

Community
  • 1
  • 1
Pavan Manjunath
  • 27,404
  • 12
  • 99
  • 125