In-Process vs. Out-of-process COM Servers


COM Servers come in two flavors: in-process and out-of-process. Basically, the in-process server is a DLL (Dynamic Link Library) in Win32 or a shared library on other operating systems. By contrast, an out-of-process server is an executable. Each have their advantages and disadvantages. The COM in-process server is actually loaded into the process space of the calling application, which means greater speed, but also means the calling application will crash if the the COM object misbehaves. Out-of-process servers exist in a different process space from the calling client, which means all function arguments and return values must be "marshalled" between the two address spaces. This in turn means slower speed but a more robust implementation. DCOM servers are often out-of-process servers (EXEs), but an in-process COM compononent can act as a DCOM server if it is "wrapped" in a special type of executable called a surrogate. COM provides a default surrogate for in-process COM servers that want to be DCOM servers; or you can write your own. o