Click here to Skip to main content
15,891,597 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: dual interface Pin
George_George11-Sep-08 23:14
George_George11-Sep-08 23:14 
GeneralRe: dual interface Pin
CPallini11-Sep-08 23:32
mveCPallini11-Sep-08 23:32 
GeneralRe: dual interface Pin
George_George11-Sep-08 23:13
George_George11-Sep-08 23:13 
GeneralRe: dual interface Pin
CPallini11-Sep-08 23:45
mveCPallini11-Sep-08 23:45 
GeneralRe: dual interface Pin
George_George11-Sep-08 23:48
George_George11-Sep-08 23:48 
GeneralRe: dual interface Pin
CPallini12-Sep-08 0:44
mveCPallini12-Sep-08 0:44 
GeneralRe: dual interface Pin
George_George12-Sep-08 19:48
George_George12-Sep-08 19:48 
GeneralRe: dual interface Pin
Scott Holt12-Sep-08 14:38
Scott Holt12-Sep-08 14:38 
Wink | ;) Wink | ;) Actually, "dual interface" refers to a COM class's ability to have its methods bound at compile time OR at run-time.

Generally, all COM classes implement "custom" interfaces - after all, they do things that are specific to defined set of requirements, and are thus "custom".

The COM class's methods are bound at compile time into a virtual function table, or VTABLE. For a program (client) to invoke the COM class's methods, it must have "knowledge" of the methods exported by the COM component at the time the client program itself is compiled into executable form. For applications where the COM object (server) and the client program are designed and built together, the client can easily have such "knowledge". I often develop COM servers and clients simultaneously, and my client programs have "intimate" knowledge of the names of the methods exported by the COM server.

But what about client programs that want to use a COM server's methods at RUN TIME, but do not necessarily know the names and other properties of the methods exported by the COM server? This situation arises very often for scripting languages where the executable code is built "on the fly".

The process whereby a client program "discovers" and uses the methods exported by a COM server is called "Run-time" binding, also known as "late" binding. This process allows scripting languages to identify what interfaces (methods) a COM class supports at run time, long AFTER the COM class has been compiled into executable code. This is done through QueryInterface and the IDispatch method. Thus, a COM class must support the IDispatch interface if it wants to allow client programs to bind to its methods at run-time.

A COM class that supports IDispatch is thus said to be "dual interface" - a client program with "intimate" knowledge of its method's names and parameters can bind to it a compile time, OR the client can bind to its methods at run time via QueryInterface and IDispatch.

Incidentally, "IDispatch" is aptly named because it is a method that "dispatches" a function call to the proper method within the COM server.
GeneralRe: dual interface Pin
George_George12-Sep-08 19:58
George_George12-Sep-08 19:58 
GeneralRe: dual interface Pin
Scott Holt13-Sep-08 1:25
Scott Holt13-Sep-08 1:25 
GeneralRe: dual interface Pin
George_George14-Sep-08 0:16
George_George14-Sep-08 0:16 
GeneralRe: dual interface Pin
Scott Holt16-Sep-08 9:24
Scott Holt16-Sep-08 9:24 
GeneralRe: dual interface Pin
George_George16-Sep-08 19:56
George_George16-Sep-08 19:56 
GeneralRe: dual interface Pin
Scott Holt18-Sep-08 2:24
Scott Holt18-Sep-08 2:24 
GeneralRe: dual interface Pin
George_George18-Sep-08 21:27
George_George18-Sep-08 21:27 
GeneralRe: dual interface Pin
Scott Holt22-Sep-08 2:25
Scott Holt22-Sep-08 2:25 
GeneralRe: dual interface Pin
George_George22-Sep-08 19:40
George_George22-Sep-08 19:40 
GeneralRe: dual interface Pin
Scott Holt24-Sep-08 0:40
Scott Holt24-Sep-08 0:40 
GeneralRe: dual interface Pin
George_George24-Sep-08 0:46
George_George24-Sep-08 0:46 
GeneralRe: dual interface Pin
Scott Holt25-Sep-08 0:13
Scott Holt25-Sep-08 0:13 
GeneralRe: dual interface Pin
George_George27-Sep-08 0:16
George_George27-Sep-08 0:16 
GeneralRe: dual interface Pin
George_George11-Sep-08 23:50
George_George11-Sep-08 23:50 
GeneralRe: dual interface Pin
CPallini12-Sep-08 0:56
mveCPallini12-Sep-08 0:56 
GeneralRe: dual interface Pin
George_George12-Sep-08 19:49
George_George12-Sep-08 19:49 
GeneralRe: dual interface Pin
George_George12-Sep-08 19:58
George_George12-Sep-08 19:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.