When linking statically, does the linker include the whole library?

后端 未结 4 517
失恋的感觉
失恋的感觉 2020-12-16 14:48

For example, if I static link to freeglut, does the compiler include everything from freeglut or only the parts that I use? Of course, this implies that the linker (or compi

4条回答
  •  遥遥无期
    2020-12-16 15:20

    Yes, the linker will include just the translation units that your code references.

    If you generate a map file for your executable then you can see exactly what it contains.

提交回复
热议问题