开发者

How does compiler(gcc) know whether a function is to be dynamically linked or not?

For example,printf is dynamically linked.

But how does the compiler(g开发者_如何学编程cc) know that?


gcc doesn't know that. It knows there is a function printf and it knows how to call it, but the object file it generates contains a call to an unresolved symbol.

The symbol is then resolved by the linker, which is given all your object files and libraries. The linker finds the symbol printf in a library, and after its combined all the relevant modules, it updates the unresolved calls.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜