LABRADOR: Implements a Server with an Out-of-Proc Custom Interface and Compiler COM Support

Click to open or copy the LABRADOR project files.

This sample shows how to use ATL to implement an EXE server. The server allows creation of an object that supports two custom interfaces, defined in Labrador.idl. Compiler COM support is used to implement custom interfaces that perform non-trivial marshaling of a C-style array.

Compare this sample with the LABRADOR sample in the ATL directory.

Running the Sample

You need to build and set up three components: the server, the marshaling DLL, and the driver.

The Server

  1. Build Labrador.exe from within Visual C+ using the Labrador.dsw project file.

  2. Run the server once with the /RegServer command-line option to set up the registry (for convenience, a custom build rule does this for you).

The Marshalling DLL

  1. Build the proxy/stub marshaling DLL, Labps.dll, by running NMAKE from the command line:
    NMAKE -f labps.mak

  2. Register the DLL by running REGSVR32 from the command line:
    REGSVR32 labps.dll

The Driver

  1. Go to the LABDRIV subdirectory, open the Labdriv.dsw project file within Visual C++ and build Labdriv.exe.

  2. Run the driver from the debugger or from the command line. The driver will create an object, make a few calls into it, and then release it.

This sample demonstrates the following keywords:

#import; _com_ptr_t; _com_error.

See also Compiler COM Support and ATL LABRADOR sample.