Important: The information in this document is obsolete and should not be used for new development.
CFM-Based Code Originates the Call
If CFM-based code makes a pointer-based call to a routine that might be in classic 68K code, you should call the routineCallUniversalProc
to invoke a universal procedure pointer instead of a standard procedure pointer. For example, instead of simply calling an external routine using
(*moo)(cow);you must call
CallUniversalProc((UniversalProcPtr) moo, mooProcInfo, cow);wheremooProcInfo
describes the calling conventions ofmoo
. See Inside Macintosh: PowerPC System Software for more information on setting up theProcInfo
data structure.
Calling
- IMPORTANT
- In general you need to call
CallUniversalProc
only when calling external routines. Most CFM-based to CFM-based calls (including pointer-based calls) know that the called routine is CFM-based, so they do not need to callCallUniversalProc
.CallUniversalProc
invokes the Mixed Mode Manager, which decides if a mode switch is necessary.If the pointer it received (
*moo
in this case) turns out to point to a routine descriptor, the call requires a mode switch.The Mixed Mode Manager uses the routine descriptor to translate the parameter information into the form that the classic 68K routine expects to see and then calls the routine. After executing the routine, any return values are translated and passed back to the calling CFM-based routine.If no mode switch is necessary the Mixed Mode Manager allows the call to be made normally. When the called routine returns, control passes back directly to the caller, not the Mixed Mode Manager.