Debugging a COM Object

   

A Component Object Model (COM) server is a dynamic-link library (DLL) or executable file that implements one or more classes, each of which implements one or more interfaces. A COM interface is a group of semantically related functions, and all access to an object’s capabilities occurs through the various interfaces that the object supports.

Debugging a COM server differs considerably from debugging an executable or an applet, primarily because a COM server is not intended to run as a stand-alone application. Instead, it exists to provide services to clients. Such clients can be either executable files, Active Server Pages (ASP), or other dynamic-link libraries.

Consequently, to debug a COM server, you’ll typically load the project into Visual J++, and then configure the Visual J++ environment to launch your debugging client. Next, you’ll set breakpoints in your object code, so that when the Visual J++ environment starts your debug client, the execution of your object code will stop at a specified point. After a breakpoint is triggered, you can step through your server object code, just as you would if you were debugging an executable or an applet.

The approach that you take to debugging your object depends primarily on two factors: the types of debugging clients that will access your object’s services, and the environment in which your object is designed to operate.

This section explains three approaches that you can take to debugging a COM server. These approaches are distinguished from one another based on the client type. Topics covered include: