Important: The information in this document is obsolete and should not be used for new development.
CloseConnection
You can use theCloseConnection
function to close a connection to a fragment.
OSErr CloseConnection (ConnectionID *connID);
- connID
- A connection ID.
DESCRIPTION
TheCloseConnection
function closes the connection to a fragment indicated by theconnID
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 timeExitToShell
is called for your application, so you need to callCloseConnection
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
fragNoErr 0 No error fragConnectionIDNotFound -2801 Connection ID is not valid