ISurrogate (Compact 2013)

3/26/2014

This interface defines two methods: one for dynamically loading new DLL servers into an existing surrogate, and one to free the surrogate when it is no longer needed.

A surrogate is an EXE process into which a DLL server can be loaded to give the DLL server the advantages of an EXE server without the coding overhead. It can also allow independent DLL servers to be located together within a single process, reducing the total number of processes needed.

DLL servers are easy to write using standard development tools and running them in a surrogate process provides the benefits of an executable implementation, including fault isolation, the ability to serve multiple clients simultaneously, and allowing the server to provide services to remote clients in a distributed environment.

When to Implement

If you are using the system-supplied surrogate, which implements this interface, you do not need to implement it specifically. All surrogate processes must implement this interface, so if you are writing a custom surrogate, you must implement it along with the IUnknown, IClassFactory, and IMarshal interfaces.

When to Use

In general, you would not call the methods of ISurrogate directly. COM calls the ISurrogate::LoadDllServer method when there is an activation request for a class registered with the DllSurrogate named-value. COM also calls ISurrogate::FreeSurrogate when all DLL servers running in the surrogate have terminated.

Methods

The following table shows the methods for this interface in the order that the compiler calls the methods. Like all COM interfaces, this interface inherits the methods for the IUnknown interface.

IUnknown method

Description

QueryInterface

Returns pointers to supported interfaces.

AddRef

Increments reference count.

Release

Decrements reference count.

ISurrogate method

Description

LoadDllServer

Creates an uninitialized object.

FreeSurrogate

Locks object application open in memory.

Remarks

To determine whether the platform supports this interface, see Determining Supported COM APIs.

.

Requirements

Header

objidl.idl

Library

ole32.lib,
uuid.lib

See Also

Reference

COM Interfaces
IClassFactory
IMarshal
IUnknown