Carbon


CloseConnection

Header: CodeFragments.h Carbon status: Supported

Closes a connection to a fragment.

OSErr CloseConnection (
    CFragConnectionID *connID
);
Parameter descriptions
connID

A pointer to a connection ID.

function result

A result code.

DISCUSSION

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 function 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).

AVAILABILITY

Supported in Carbon. Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.


© 2000 Apple Computer, Inc. (Last Updated 6/30/2000)