|
||
Adding a SilverPlus entry point |
||||||||||
A SilverPlus DLL is a normal MFC or Win32 DLL with an entry point called SilverCExec that must be exported. This topic describes the format of, and provides a framework skeleton for, the entry point.
|
||||||||||
Function table declaration |
A SilverPlus DLL must contain a declaration for the SilverScreen API function table in order to access the SilverScreen API. This amounts to including ssrex.h, adding a global variable declaration, and initializing the variable in the SilverPlus entry point (SilverCExec). The following code shows all that is necessary to declare the function table pointer:
Note: The include file SILVER2.H may be used instead of ssrex.h, since it includes SSREX.H
|
|||||||||
Entry point declaration |
A SilverPlus DLL must also contain an exported function signature for SilverCExec, which is required by the SilverC DLL loading and unloading code. It is also used to pass the SilverScreen API function table pointer to the DLL (it contains function pointers corresponding to members of the SilverC library), so that SilverC functions may be used by the DLL. It is also used by a SilverC program to call into the DLL, thus serving as the gateway between SilverC and the DLL.
|
|||||||||
|
The function signature for SilverCExec must match the following:
That is:
Where:
op is a user-defined operation code; with the exception of anything less than the value of REX_USER_BASE, which is reserved for SilverScreen library initialization
data is dependent on the operation code; in the case where op is equal to REX_FIRST_LOAD, this will be a pointer to an SSREX structure. The alignment for members of structures passed via data (including the SSREX) structure must be 4 bytes.
|
|||||||||
Win32 Skeleton |
The following code show a Win32 DLL skeleton which implements SIlverCExec. The initialization of the SilverScreen API table is marked in red to signify its importance and to draw attention to the code.
|
|||||||||
Example |
For an example of an MFC DLL skeleton, see the SilverPlus sample MFDLL. |