COM DLL Infrastructure

DTS Programming

DTS Programming

COM DLL Infrastructure

A Data Transformation Services (DTS) custom transformation is implemented as a COM DLL. All COM DLLs must implement several functions that are involved with creating, loading, unloading and registering the component.

Function Description
DLLMain Initializes the DLL. DLLMain is called by the operating system when it first loads the DLL.
DLLGetClassObject Creates a class factory for the transformation and returns a pointer to its interface. COM calls through the interface to create the transformation
DLLCanUnloadNow Returns a code indicating whether the DLL can be unloaded. It will be unloaded if no other application is using any transformation the DLL contains.
DLLRegisterServer Inserts information about each transformation into the system registry under the key HKEY_CLASSES_ROOT\CLSID. This registry information specifies the location of the DLL executable file, the transformation ProgID, and the DTS transformation component category.
DLLUnregisterServer Removes the registry information inserted by DLLRegisterServer.

These functions are generated automatically if you use the Active Template Library (ATL) facility of Microsoft® Visual C++® and the ATL wizards to create the framework for your custom transformation.

For DLLRegisterServer and DLLUnregisterServer, you will need to either add code to the functions or add entries to the registry script in order to include information about DTS transformations in the registration for the transformation. This is not necessary if you use the custom transformation template supplied with Microsoft SQL Server™ 2000. For more information, see Registration Requirements for Transformations.