SOM Kernel Reference 1-51
SOM_ClassLibrary Macro
Purpose
Identifies the file name of the DLL for a SOM class library in a Windows LibMain function.
Syntax
void SOM_ClassLibrary (string “libname.dll ”);
Description
Each Windows SOM class library must supply a Windows LibMain function. In LibMain, the
SOM_ClassLibrary macro identifies both the actual file name of the library as it would
appear in a Windows LoadLibrary call and the location of the library’s SOMInitModule
function. This information is passed to the SOM Kernel, which in turn registers the library
and schedules the execution of the SOMInitModule function. This macro can also be used
in OS/2 class libraries within the context of a DLL “init/term” function.
Typically, the SOM Kernel invokes the SOMInitModule function of each statically loaded
class library during the execution of the somMainProgram function in the using application.
For dynamically loaded class libraries, SOMInitModule is invoked immediately upon
completion of the library’s LibMain (or an OS/2 DLL “init/term”) function.
Because the SOM_ClassLibrary macro expands to reference the SOMInitModule function,
either a declaration of the SOMInitModule function, or the function itself, should precede
the appearance of SOM_ClassLibrary in the current compilation unit, as shown in the
following example).
Parameters
libname.dll The name of the file containing the DLL (as the name would appear in a
Windows LoadLibrary call).
Example
/* This example illustrates the use of the SOM_ClassLibrary
macro in a Windows LibMain function */
#include <som.h>
SOMEXTERN void SOMLINK SOMInitModule (long majorVersion,
long minorVersion,
string className);
#include <windows.h>
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 */
}
Related Information
Macros: SOM_MainProgram
Functions: somMainProgram
Kommentare zu diesen Handbüchern