dynamic binding and dynamic linking

2019-09-07 21:15发布

  1. Quoted from Dynamic Binding C++,

    dynamic binding is orthogonal to dynamic linking...

    I was wondering how to understand the meaning of orthogonal"? Is it because

    • compilation of source code into machine code is like going deep, and linkage of various machine codes is like going horizontal, and so they are orthogonal to each other,

    • (static/dynamic) name binding is a concept in compilation

    • static/dynamic linking is a concept in linkage?

  2. if in dynamic linking, any involved binding, i.e., any involved association of objects (data and/or code) with identifiers is dynamic binding?

Thanks!

1条回答
够拽才男人
2楼-- · 2019-09-07 22:07

"Orthogonal" means that the presence or status (in a more abstract sense) of the one is not dependent at all on the corresponding status of the other. In this specific case it means that dynamic linking may occur irrespective of whether dynamic binding occurs, and vice versa.

As a practical example, consider that dynamic binding is the resolution at runtime of what piece of code should be executed as a result of a function call present in the source code. That piece of code may be present in a library which is linked into the executable at link time (static linking), or it may be present in a library dynamically loaded at runtime (dynamic linking). The binding part does not care about how the linking was done; therefore, it is orthogonal to the latter.

You also ask:

if in dynamic linking, any involved binding, i.e., any involved association of objects (data and/or code) with identifiers is dynamic binding?

This question is meaningless, as there is no binding involved in the linking process. Binding may occur statically (resolved by the compiler and baked into the object code) or dynamically (resolved at runtime), but the decision of how to bind and the logic that resolves the binding does not interact at all with the linking.

查看更多
登录 后发表回答