1-44 SOMobjects Base Toolkit: Programmer’s Reference Manual
SOMInitModule Function
Purpose
Invokes the class creation routines for the classes contained in an OS/2 or Windows class
library (DLL).
Syntax
SOMEXTERN void SOMLINK SOMInitModule (
long MajorVersion,
long MinorVersion,
string ClassName);
Description
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 SOMInitModule. 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 that follows).
Parameters
MajorVersion The major version number of the class that was requested when the library
was loaded.
MinorVersion The minor version number of the class that was requested when the library
was loaded.
ClassName The name of the class that was requested when the library was loaded.
Example
#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);
}
Kommentare zu diesen Handbüchern