请教早绑定(early binding)的问题
各位:本人在学习Automation时发现所看潘爱民的<<com原理与应用>>和msdn中关
于 早绑定(early binding)的说法有冲突,请给指出究竟谁的解答是正确的
early binding?还是我理解有错?谢谢!
<<com原理与应用>> p359:
"通过早绑定,像vb或vba这样的控制器可以预处理basic代码,在编译时刻
把属性和方法符号转换到分发id,然后再检查属性类型,方法的返回类型和方法
参数,必要时给出编译时刻错误信息。"
msdn :
Early Binding: VTBL Binding
A VTBL is a data structure containing the addresses (pointers) for the
methods and properties of each object in an Automation server. Using
the VTBL is generally known as early binding in VBA. Frequently, early
binding requires type information provided in the form of a type
library. This type information allows VBA to perform compile-time
syntax and type checking. At run time, this type of binding is faster,
as the entry points for the Automation server are already known and the
data types and syntax have already been verified.
ID binding :
The ability to bind member names to dispatch identifiers (DISPIDs) at
compile time (for example, by obtaining the IDs from a type library).
This approach eliminates the need for calls to
IDispatch::GetIDsOfNames, and results in improved performance over
late-bound calls. See also late binding and VTBL binding.
我的感觉:
好像潘爱民的解释是ID Binding,而不是Early Binding,但我不能说就
是理解了early binding,所以我希望大家给我一个准确的答案,最好附上理由,
多谢!