Chapter 4. In-Process Servers
In the last chapter, you learned about the memory layout of VB COM
objects. In particular, you learned how VB allocates memory for
objects with multiple interfaces. You also learned how VB enables you
to request different portions of this memory using the
QueryInterface method of the
IUnknown interface (henceforth referred to as
QI ).
Most important was the idea that all
interfaces are created equal. In other words, the memory layout of an
interface in any language is basically the same—it is a virtual
table pointer (vptr) pointing to a virtual table (vtable). A vtable
is nothing more than an array of pointers to the addresses of
functions in memory. COM rules state that the first three functions
in the vtable of a COM interface must be the methods of
IUnknown: QueryInterface,
AddRef, and Release. You
learned from Chapter 3 that Visual Basic built a
little object to manage the IUnknown
implementation for the entire object. You also learned some of the
COM rules for allocating memory in the last chapter. One rule
discussed in the chapter was that memory for COM objects must be
allocated by the server code. You also learned that the server
provides the definitions of its COM objects for the client through a
file called a type library.
In this chapter, you will learn the whole story of activation for ActiveX DLLs. The term activation refers to the process that occurs at the API level from the time the client requests a new server object to the time it ...