next up previous contents index
Next: 4.4.2 Calling Conventions Up: 4.4 Binary Issues Previous: 4.4 Binary Issues

4.4.1 Interface Structure

   figure1800
Figure: Diagram of the structure of a COM interface. The client holds a pointer to a pointer to a table of function pointers; the pointers in the function table point to the object's implementations of the methods exported to the client through the interface.

Figure 4.1 shows a diagram of the structure of a COM interface. From the client's viewpoint, a reference to a COM interface is a pointer to a pointer (the function table pointer) to a table of pointers to functions (the dynamic dispatch table). The function table pointer is generally just a part of a larger data structure representing the internal state of the object, illustrated in the figure by the dotted box; however, only the function table pointer itself is visible to the client. To call one of the interface's methods, the client follows the interface pointer to the function table pointer, then dereferences the function table pointer to find the function table, looks up the appropriate function pointer in the table, and finally calls the function. In general, the first parameter to this function will be a copy of the original interface pointer the client started with, allowing the object implementation to locate its private object state quickly and easily.



University of Utah Flux Research Group