Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: PowerPC System Software /
Chapter 3 - Code Fragment Manager / Code Fragment Manager Reference
Code Fragment Manager Routines / Unloading Fragments


CloseConnection

You can use the CloseConnection function to close a connection to a fragment.

OSErr CloseConnection (ConnectionID *connID);
connID
A connection ID.
DESCRIPTION
The CloseConnection function closes the connection to a fragment indicated by the connID parameter. CloseConnection decrements the count of existing connections to the specified fragment and, if the resulting count is 0, calls the fragment's termination routine and releases the memory occupied by the code and data sections of the fragment. If the resulting count is not 0, any per-connection data is released but the code section remains in memory.

When a fragment is unloaded as a result of its final connection having been closed, all libraries that depend on that fragment are also released, provided that their usage counts are also 0.

The Code Fragment Manager automatically closes any connections that remain
open at the time ExitToShell is called for your application, so you need to call CloseConnection only for fragments you wish to unload before your application terminates.

SPECIAL CONSIDERATIONS
You can close a connection only to the root of a loading sequence (that is, the fragment whose loading triggered the entire load chain).

RESULT CODES
fragNoErr0No error
fragConnectionIDNotFound-2801Connection ID is not valid

Previous Book Contents Book Index Next

© Apple Computer, Inc.
3 JUL 1996