The programmer decides what processing needs to be done when an event occurs and then places the appropriate code either in a procedure or in a method of an object. This procedure or method is called a callback. (The callback is provided to EMan at the time of registration and is called by EMan when a registered event occurs.) The signature of a callback is fixed by the framework and must have one of the following three signatures:
void SOMLINK EMRegProc(SOMEEvent, void *); void SOMLINK EMMethodProc(SOMObject, SOMEEvent, void *); void SOMLINK EMMethodProcEv(SOMObject, Environment *Ev, SOMEEvent, void *); /* On OS/2, they all use "system" linkage */ /* On Windows, the SOMLINK keyword is Not included if the * application is intended to support multiple instances. */
The three specified prototypes correspond to a simple callback procedure, a callback method using OIDL call style, and a callback method using IDL call style. The parameter type SOMEEvent refers to an event object passed by EMan to the callback. Event objects are described below.
NOTE: When the callbacks are methods, EMan calls these methods using Name-lookup Resolution (see Chapter 5 Section 5.3 on Method Resolution). One of the implications is that at the time of registration EMan queries the target object's class object to provide a method pointer for the method name supplied to it. Eman uses this pointer for making event callbacks.