The typed way to use the COM DLL

 

Note for Visual C++ users: You should use ITLogLib2/VC6 instead of ITLogLib2/COM. This is a special variant of the logging library that easier to use with VC6 and runs faster. Refer to its help file for documentation.

Exception: In mixed language projects where all logging output should be mixed into the same logchannels you would use the COM DLL indeed.

 

In order to use the COM DLL your programming environment must support usage of COM DLLs. The process to use such COM DLLs can be different. Two typical ways are:

 

a)    Most environments have a menu item to add the COM DLL to your project.

Examples:

·      Visual Basic 6: Menu item "Project / References…".
(The way for VB is described in detail
here.)

·      Delphi 6: Menu item "Project / Import Type Library…".

·      Visual J++ 6: Menu item "Project / Add COM Wrapper…".

 

After selecting this menu item such environments normally allow you to

·      Select one of the COM type libraries registered in the system registry
This is the recommended way. Select "ITLogLib2 (COM DLL)
m.n Type Library" (m.n is a version number) from the list of registered components.

or to

·      Select a type library stored in an (COM-)DLL file in the file system.
This more inconvenient. You would select the file "ITLogLib2ComDll.dll" found in the directory tree of your ITLogging installation.

 

After this you you be able to use the COM DLL (its classes and the enum type) in your project:

·      Delphi 6 and Visual J++ 6 generate and add wrapper classes to your project for that purpose. Look at them in the code or the class browser for details about the method parameter types etc. for these languages.

·      Visual Basic 6 provides the LogLib classes without generating code. You find them in the Object Browser.

 

b)    Some environments have an import statement for COM type libraries.

Example for Visual C++ 6 (VC6)

VC6 provides an #import statement:

#import <ITLogLib2ComDll.dll>

In order to compile this the search path for include files must contain the directory of the COM DLL.

Alternatively, you could use the form

#import <Path to the COM DLL directory\ITLogLib2ComDll.dll>

After the import statement you can use the types of the COM DLL. Behind the scene VC generates one or two headerfiles. You can use them to look up the details of method parameter types etc. for VC. But don’t forget that in most cases you can use ITLogLib/VC6 when working with VC6. See the note at the begin of the topic.