User`s guide
7 Libraries
int main()
{
int err = 0;
#ifdef __APPLE_CC__
pthread_t id;
pthread_create(&id, NULL, run_main, &err);
CFRunLoopSourceContext sourceContext;
sourceContext.version = 0;
sourceContext.info = NULL;
sourceContext.retain = NULL;
sourceContext.release = NULL;
sourceContext.copyDescription = NULL;
sourceContext.equal = NUL L;
sourceContext.hash = NULL;
sourceContext.schedule = NULL;
sourceContext.cancel = NULL;
sourceContext.perform = NULL;
CFRunLoopSourceRef so urce Ref = CFRunLoop SourceCreate(NULL, 0,
&sourceContext);
CFRunLoopAddSource(CFRunLoopGetCu rrent(), sourceRef,
kCFRunLoopCommonModes);
CFRunLoopRun();
#else
run_main(&err);
#endif
return err;
}
The Mac version of the matrixd river ap pl ica t ion d i ffers fro m the version on
other platforms in these significant ways:
• We have created a
run_main() function that performs the basic tasks of
initialization, calling the library’s functions, and termination. C ompare
this function with the
matrixdriver main( ) function on other platforms,
listed in the earlier example.
7-36