Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Mac OS Runtime Architectures /
Chapter 6 - The Mixed Mode Manager / Universal Procedure Pointers and Routine Descriptors


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 routine CallUniversalProc 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);
where mooProcInfo describes the calling conventions of moo. See Inside Macintosh: PowerPC System Software for more information on setting up the ProcInfo data structure.

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 call CallUniversalProc.
Calling 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.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
11 MARCH 1997