dynamic binding and dynamic linking

荒凉一梦 提交于 2019-12-25 03:24:24

问题


  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:


"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.



来源:https://stackoverflow.com/questions/5449876/dynamic-binding-and-dynamic-linking

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!