Important: The information in this document is obsolete and should not be used for new development.
Getting Information About Exported Symbols
In cases in which you prepare a fragment programmatically (that is, by calling Code Fragment Manager routines), you can get information about the symbols exported by that fragment by calling theFindSymbol
,CountSymbols
, andGetIndSymbol
functions.The
CountSymbols
function returns the total number of symbols exported by a fragment.CountSymbols
takes as one of its parameters a connection ID; accordingly, you must already have established a connection to a fragment before you can determine how many symbols it exports.Given an index ranging from 0 to one less than the total number of exported symbols in a fragment, the
GetIndSymbol
function returns the name, address, and class of a symbol in that fragment. You can useCountSymbols
in combination withGetIndSymbol
to get information about all the exported symbols in a fragment. For example, the code in Listing 3-4 prints the names of all the exported symbols in a particular fragment.Listing 3-4 Finding symbol names
void MyGetSymbolNames (ConnectionID myConnID); { long myIndex; long myCount; /*number of exported */ /*symbols in fragment*/ OSErr myErr; Str255 myName; /*symbol name*/ Ptr myAddr; /*symbol address*/ SymClass myClass; /*symbol class*/ myErr = CountSymbols(myConnID, &myCount); if (!myErr) for (myIndex = 0; myIndex < myCount; myIndex++) { myErr = GetIndSymbol(myConnID, myIndex, myName, &myAddr, &myClass); if (!myErr) printf("%P", myName); } }If you already know the name of a particular symbol whose address and class you want to determine, you can use theFindSymbol
function. SeeInside Macintosh: PowerPC System Software for details.