Chapter 5. Out-of-Process Servers and COM’s Remoting Architecture

In the last chapter, you learned about in-process activation. You learned what information is stored in the type library and what the client has to do to use vtable binding. We have also been talking about what constitutes an interface. An interface stored in a VB variable is simply the address of a vptr to a vtable. In the last chapter, you also learned about the process by which COM loads DLLs into memory. We discussed that when you call New, VB translates the New command into a call to CoCreateInstanceEx, the function responsible for creating instances of a class.

In this chapter, you will learn about COM’s remoting layer. You will also learn about apartments. Apartment architecture enables components that are thread safe to talk to components that are not thread safe.

ActiveX EXEs

EXEs load in their own address space. While there are tricks for sharing memory between two executables, for the most part, every executable loads in its own protected memory space. The memory space is 4 GB. This doesn’t mean that by installing Windows your machine receives 4 GB of RAM. Most of us mortals have far less physical memory than that. However, the operating system simulates that each process runs in a memory space of 4 GB. In reality, the OS uses a swap file to map virtual memory to physical memory. The details of how the memory mapper works are beyond the scope of this book. However, it is sufficient for us to know that the ...

Get COM+ Programming with Visual Basic now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.