Important: The information in this document is obsolete and should not be used for new development.
Multiple Names for the Same Fragment
The CFM-based architecture allows you to assign multiple names to a single fragment. For example, if you have a fragment that implements multiple SOM classes, you can assign a separate name for each class, all of which point to the same fragment.You store multiple names as multiple
'cfrg'0
entries. As mentioned earlier, the'cfrg'0
resource is actually an array, so you can store as many fragment descriptions as you like.For example, the
'cfrg'0
resource in Figure 3-1 contains two fragment entries,mooFrag
andcowFrag
, which both point to the same fragment (that is, their'cfrg'0
resource entries map to the same location). If the Code Fragment Manager is called to preparemooFrag
and then called sometime later to preparecowFrag
, it knows that they are the same fragment and treats them as such. For example, if the preparation request forcowFrag
came from the same process, it increments the reference count formooFrag
and creates a closure using the existing connection. In this manner it is possible to create "aliases" for fragment names.Figure 3-1 Two names for a single fragment
You can use aliasing to update older libraries without having to change the client fragments that import from them. For example, say you build a library
cowFrag
and create several applications that use it. Sometime later you build another librarymooFrag
that contains all the functionality ofcowFrag
as well as some new features. If the'cfrg'0
entry formooFrag
contains an entry for bothmooFrag
andcowFrag
, then the following are possible:
- Applications built with
mooFrag
can run withmooFrag
and use all of the available features.- Applications built with
cowFrag
can run withmooFrag
and use the features previously available incowFrag
.
© Apple Computer, Inc.
11 MARCH 1997