|
||
Creating a SilverPlus Stub |
||||
A SilverPlus stub is a SilverC program that manages the loading and unloading of a SilverPlus DLL. The SilverC program that loads a SilverPlus DLL is not special or restricted in any way. However, experience has taught that a SilverPlus DLL should perform the SilverPlus application's work, and that the SilverC program should do little more than invoke the application. The term 'stub' was born of this minimalist approach to the task.
|
||||
Assuming that you have created a SilverPlus DLL called SilverDLL, and that you wish to write a SilverC stub to load it, make it work, and then unload it, here is how you would proceed:
The following code is SilverC code to load the DLL developed earlier in this chapter. It is assumed to reside in either a Debug or Release sub-diretory of SilverScreen, depending upon how it was built.
|
||||
A line in the above code has been marked in red to draw your attention to it. The SilverPlus entry point you wrote earlier returned a value of 1 if the user answered yes and 0 otherwise. That value is returned through the rex_exec function to your SilverC stub. In this way you may communicate between the stub and the DLL.
|
||||
|
See Also: SilverC Language Development |