The following code segment illustrates how to write a callback procedure:
void SOMLINK ReadMsg( SOMEEvent event, void *targetData ) { int sock; printf( "Data = %s\n", targetData ); switch( _somevGetEventType( event )) { case EMSinkEvent: printf("callback: Perceived Sink Event\n"); sock = _somevGetEventSink(event); /* code to read the message off the socket */ break; default: printf("Unknown Event type in socket callback\n"); } } /* On OS/2, "system" linkage is also required. */ /* On Windows, callbacks do not use the SOMLINK keyword if * the application is intended to support multiple instances. */