Directory Services

Late Binding vs. Vtable Access in the ADSI Extension Model

A dual interface enables direct vtable access to all its functions while a dispatch interface does not. A C/C++ client can query for a dual interface pointer and use direct vtable access to invoke its functions. This provides faster access than invoking the function using the IDispatch::GetIDsOfNames and IDispatch::Invoke functions. This is especially true in the extension model, because all dual interfaces in an extension object must delegate their GetIDsOfNames and Invoke functions back to the aggregator (ADSI) first. The aggregator then must perform extra internal steps to identify which extension object, possibly including the aggregator itself, provides support for the function called and redirect the call to the appropriate object.

Visual Basic also invokes a dual-interface function using direct access to a vtable, if it has a pointer to the interface and access to type data from the type library. ADSI clients written in Visual Basic can specify a pointer to a dual interface, for example, IADs, explicitly, and thus enable vtable access to functions in the interface.

Example

[Visual Basic]
Dim inf as IADs
 
Set inf = GetObject("LDAP://CN=jeffsmith,DC=fabrikam,DC=com") ' An object that supports IADsDualInf.
inf.Get("name") 'IADs.Get() will be invoked through direct vtable access.

Because an IDispatch interface does not support vtable access, this example does not apply. That is, a dispatch function is always invoked through the IDispatch::GetIDsOfNames and IDispatch::Invoke functions only.

Current releases of VBScript and JavaScript also do not support vtable access. Therefore, a dual interface in a VBScript or JavaScript environment performs like a dispatch interface.