SOMInitModule

This function invokes the class creation routines for the classes contained in an OS/2 or Windows class library (DLL).

Syntax
 long     majorVersion; long     minorVersion; string   className;

SOMInitModule(majorVersion, minorVersion, className); 

Parameters

 * majorVersion (long): The major version number of the class that was requested when the library was loaded.
 * minorVersion (long): The minor version number of the class that was requested when the library was loaded.
 * className (string) : The name of the class that was requested when the library was loade

Remarks
On OS/2 or Windows, a class library (DLL) can contain the implementations for multiple classes, all of which should be created when the DLL is loaded. On OS/2, when loading a DLL, the SOM class manager determines the name of a DLL initialization function, and if the DLL exports a function of this name, the class manager invokes that function (whose purpose is to create the classes in the DLL). SOMInitModule is the default name for this DLL initialization function.

On Windows, the SOM class manager does not call this function. It must be called from the default Windows DLL initialization function, LibMain. This call is made indirectly through the SOM_ClassLibrary macro (see the Example).

Example Code
 #include "xyz.h"  #ifdef __IBMC__ #pragma linkage (SOMInitModule, system) #endif SOMEXTERN void SOMLINK SOMInitModule (long majorVersion,                             long minorVersion, string className) {      SOM_IgnoreWarning (majorVersion);  /* This function makes  */ SOM_IgnoreWarning (minorVersion); /* no use of the passed */ SOM_IgnoreWarning (className);    /* arguments. */      xyzNewClass, (A_MajorVersion, A_MinorVersion); }  For Windows, also include the following function:  #include    int CALLBACK LibMain (HINSTANCE inst,                          WORD ds,                          WORD Heapsize,                          LPSTR cmdLine) {       SOM_IgnoreWarning (inst); SOM_ignoreWarning (ds); SOM_IgnoreWarning (heapSize); SOM_IgnoreWarning (cmdLine); SOM_ClassLibrary ("xyz.dll"); return 1; /* Indicate success to loader */ } 

Functions

 * somClassInitFuncName

Methods

 * somGetInitFunction

Macros

 * SOM_ClassLibrary