Important: The information in this document is obsolete and should not be used for new development.
GetMemFragment
You can use theGetMemFragmentfunction to prepare a memory-based fragment.
OSErr GetMemFragment (Ptr memAddr, long length, Str63 fragName, LoadFlags findFlags, ConnectionID *connID, Ptr *mainAddr, Str255 errName);
memAddr- The address of the fragment.
length- The size, in bytes, of the fragment.
fragName- The name of the fragment. (This information is used primarily to allow you to identify the fragment during debugging.)
findFlags- A flag that specifies the operation to perform on the fragment. See the description of the
GetDiskFragmentfunction on page 3-19 for the values you can pass in this parameter.connID- On exit, the connection ID that identifies the connection to the fragment. You can pass this ID to other Code Fragment Manager routines (for example,
CloseConnection).mainAddr- On exit, the main address of the fragment. The value returned is specific to the fragment itself.
errName- On exit, the name of the fragment that could not successfully be loaded. This parameter is meaningful only if the call to
GetMemFragmentfails.DESCRIPTION
TheGetMemFragmentfunction prepares for subsequent execution a fragment that
is already loaded into memory. This function is most useful for handling code that
is contained in a resource. You can read the resource data into memory using
normal Resource Manager routines (for example,Get1Resource) and then callGetMemFragmentto complete the processing required to prepare it for use (for example, to resolve any imports and execute the fragment's initialization routine).
- WARNING
- You must lock the resource-based fragment into memory (for example, by calling
HLock) before callingGetMemFragment. You must not unlock the memory until you've closed the connection to the fragment (by callingCloseConnection).![]()
RESULT CODES
fragNoErr 0 No error paramErr -50 Parameter error fragLibNotFound -2804 Specified fragment not found fragHadUnresolveds -2807 Loaded fragment has unacceptable unresolved symbols fragNoMem -2809 Not enough memory for internal bookkeeping fragNoAddrSpace -2810 Not enough memory in user's address space for section fragObjectInitSeqErr -2812 Order error during user initialization function fragImportTooOld -2813 Import library is too old fragImportTooNew -2814 Import library is too new fragInitLoop -2815 Circularity in required initialization order fragLibConnErr-2817 Error connecting to fragment fragUserInitProcErr -2821 Initialization procedure did not return noErrSEE ALSO
See "Loading Code Fragments" on page 3-10 for more details on the fragment-
loading process.