Jump to content

SOM ClassLibrary: Difference between revisions

From EDM2
Created page with "This macro identifies the file name of the DLL for a SOM class library in a Windows LibMain function. ==Syntax== <PRE> string libname.dll; SOM_ClassLibrary(libname.dll); <..."
 
Ak120 (talk | contribs)
mNo edit summary
 
Line 1: Line 1:
{{DISPLAYTITLE:SOM_ClassLibrary}}
This macro identifies the file name of the DLL for a SOM class library in a Windows LibMain function.
This macro identifies the file name of the DLL for a SOM class library in a Windows LibMain function.


==Syntax==
==Syntax==
<PRE>
string    libname.dll;
string    libname.dll;
SOM_ClassLibrary(libname.dll);
SOM_ClassLibrary(libname.dll);
</PRE>


==Parameters==
==Parameters==
; libname.dll (string) : The name of the file containing the DLL (as the name would appear in a Windows LoadLibrary call.
;libname.dll (string): The name of the file containing the DLL (as the name would appear in a Windows LoadLibrary call.


==Return Code==
==Return Code==


==Remarks==
==Remarks==
Each Windows SOM class library must supply a Windows LibMain function. In LibMain, this 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  
Each Windows SOM class library must supply a Windows LibMain function. In LibMain, this 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.
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  
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.
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 this 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 Example below).  
Because this 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 Example below).


==Example Code==
The Example illustrates the use of the SOM_ClassLibrary macro in a Windows LibMain function
The Example illustrates the use of the SOM_ClassLibrary macro in a Windows LibMain function
==Example Code==
<PRE>
<PRE>
#include <som.h>
#include <som.h>
Line 52: Line 47:
* somMainProgram  
* somMainProgram  


[[Category:SOM Kernel]]
[[Category:SOM macro]]

Latest revision as of 01:55, 6 May 2020

This macro identifies the file name of the DLL for a SOM class library in a Windows LibMain function.

Syntax

string    libname.dll;
SOM_ClassLibrary(libname.dll);

Parameters

libname.dll (string)
The name of the file containing the DLL (as the name would appear in a Windows LoadLibrary call.

Return Code

Remarks

Each Windows SOM class library must supply a Windows LibMain function. In LibMain, this 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 this 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 Example below).

Example Code

The 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

Macro

  • SOM_MainProgram

Functions

  • somMainProgram