![]() |
NewRoutineDescriptor |
||||
Header: | MixedMode.h | Carbon status: | Unsupported | |
Creates a new routine descriptor.
UniversalProcPtr NewRoutineDescriptor ( ProcPtr theProc, ProcInfoType theProcInfo, ISAType theISA );
The address of the routine.
The procedure information to be associated with the routine.
The instruction set architecture of the routine being described.
A pointer to the new routine descriptor.
The NewRoutineDescriptor function creates a new routine descriptor and returns a pointer (of type UniversalProcPtr) to it. If the value of the theProc parameter is NULL, NewRoutineDescriptor returns the value NULL.
The memory occupied by the new routine descriptor is allocated in the current heap. If you want the memory to be allocated in some other heap, you will need to set the current heap to that heap and then restore the current heap before exiting.
In general, you need to create routine descriptors only for routines whose addresses are exported to the system software (for example, a completion procedure). You do not need to create a routine descriptor for a routine that is called by code of the same type.
In general, you need to call this function only from PowerPC code. To maintain a single source code base for your software, however, you can call this function from 680x0 code, as long as you set the USESROUTINEDESCRIPTORS compiler flag to false (its default setting). To compile code for the PowerPC environment, you should set the USESROUTINEDESCRIPTORS flag to true.
The NewRoutineDescriptor function allocates memory; you should not call it at interrupt time or from any code that might be executed when memory is low. In addition, the block of memory allocated by NewRoutineDescriptor is nonrelocatable. To help minimize heap fragmentation, you should try to allocate any routine descriptors you will need early in your applications execution.
When the USESROUTINEDESCRIPTORS compile flag is false, the NewRoutineDescriptor function simply returns the address passed in the theProc parameter and does not allocate memory for a routine descriptor.
Not supported in Carbon. Not available in Carbon.
Applications should use ProcPtrs for their own code and plug-ins, and use the system-supplied UPP creation functions (such as NewModalFilterProc) for Toolbox callback UPPs. You still need to dispose of those UPPs using the appropriate system-supplied disposal function so that any allocated memory can be cleaned up when your application is running on Mac OS 8 or 9.
© 2000 Apple Computer, Inc. (Last Updated 6/30/2000)