contents   index   previous   next



THE FUNCTION HEADER

 

Starting with the definition of the function, notice that the return value is SE_CALLBACK( void ). The wrapper function returns a void result because it uses the ScriptEase API functions to indicate its return value which will of course be some ScriptEase value. Therefore, the C return value is not used for a wrapper function. The SE_CALLBACK macro takes as its parameter a C type, void. The macro itself is used to define functions that will be called from the ScriptEase engine rather than from your code. Some systems have special requirements to be able to do this, and the SE_CALLBACK macro fills those requirements for your system.

 

Wrapper functions are usually called during an seEval ScriptEase API function call. seEval evaluates a script, and if that script invokes any of your functions that are implemented via a wrapper function, that wrapper function will be called by ScriptEase. Wrapper functions receives two parameters. The first is the secontext that is doing the callback. A wrapper function can be added to several contexts, and it needs to know which one is doing the callback. You should use this provided context in any calls to ScriptEase API functions inside your wrapper function. You can compare the returned pointer against any you might have to determine which context is being called back, but doing so is frowned upon. It is better to store any needed data along with each context using the SE_SERVICES object and retrieve it in your wrapper function. The second argument is simply a numeric count of the number of ScriptEase parameters passed to your function. ScriptEase wrapper functions can take varying number of arguments depending on how you define them as we will see later. If your wrapper function takes a fixed number of arguments, you can ignore this parameter.

 


THE ARGUMENTS