SilverScreen Solid Modeler

Making the entry point work

Making the entry point work

Previous topic Next topic  

Making the entry point work

Previous topic Next topic JavaScript is required for the print function  

SilverPlusEllipse

 

Creating a SilverPlus entry point

 


Once a SilverPlus DLL has a framework that will allow it to be invoked from a SilverC stub, it is only necessary to make the DLL perform work. That can be achieved by letting a user-defined operation code  to the SilverPlus entry point trigger the work. A user-defined operation code is a code whose value is REX_USER_BASE or greater.

 

 


The skeleton we created for the entry point earlier in this chapter will be modified to perform work. Specifically, it will display a simple question, wait for an answer, and then exit. If the answer to the question was yes, then 1 will be returned and otherwise 0 will be returned.

 

C / C++ Code

 

 #include <windowsx.h>

 #include "silver2.h"

 

 . . .

 

 

 extern "C" __declspec(dllexport) int SilverCExec(int op, void *data)

    {

    int rval = 1;

 

    switch ( op )

       {

       . . .

 

       case REX_USER_BASE:

 

            // Perform stub-initiated work

            qmessage("Welcome to SilverPlus", 0, 0);

 

            if ( ! ask_yn("Is SilverPlus fun?") )

               rval = 0;

            break;

       }

 

    return rval;

    }

 

 

 


If you have been following the topics in this chapter in order, then you are at the point where you can create a SilverPlus DLL and make it perform a task using the SilverScreen API. The next topic in this chapter shows you how to create the SilverC stub necessary to load the DLL and make it perform the work.