Technical Q&ANW 36 - Calling CloseOpenTransport When Writing an App (3-July-96)QI read somewhere that you don't have to call CloseOpenTransport if you're writing an application. Is this true? A Yes and no. The original OT programming documentation stated that calling CloseOpenTransport was optional for applications. There is however a bug in OT 1.1 and earlier which will not properly clean up PPC native applications when they terminate unless CloseOpenTransport is called. Here are some rules of thumb:
static Boolean gOTInited = false; void CFMTerminate(void) { if (gOTInited) { gOTInited = false; (void) CloseOpenTransport(); } } void main(void) { OSStatus err; err = InitOpenTransport(); gOTInited = (err == noErr); // the rest of your application if (gOTInited) { (void) CloseOpenTransport(); gOTInited = false; } }
Technical Q&A Previous Question | Contents | Next Question |