ADC Home > Reference Library > Technical Q&As > Legacy Documents > Mac OS 9 & Earlier >
Legacy Document
Important: This document is part of the Legacy section of the ADC Reference Library. This information should not be used for new development.
Current information on this Reference Library topic can be found here:
Technical Q&A PPCSYS08
NewRoutineDescriptor & Porting 68K code to PPC
|
Q: I'm trying to port my 68K code to PPC. I have custom functions
defined for calling ModalDialog . Here's what my code looked like:
ModalDialog((ModalFilterProcPtr) MyFilter, &itemNum);
|
The compiler complained that it cannot covert my custom function to type
RoutineDescriptor*, so I changed it by casting it to RoutineDescriptor :
ModalDialog((RoutineDescriptor*) MyFilter, &itemNum);
|
There were no compile or link errors, but now, when I run the program, it
crashes with a type 3 error.
What's the correct way to implement this?
A: Create a UPP using NewRoutineDescriptor instead of casting to a UPP. In
Dialogs.h there is a macro for NewRoutineDescriptor called NewModalFilterProc .
Your code should look like this:
ModalFilterUPP myFilterUPP;
myFilterUPP = NewModalFilterProc(MyFilter);
ModalDialog(myFilterUPP, &itemNum);
|
See Also
- See Using Universal Procedure Pointers in Inside Macintosh: PPC System
Software, page 2-21, for more information.
|
[Jun 01 1996]
We’re sorry, an error has occurred.
Please try submitting your feedback later.
Thank you for providing feedback!
Your input helps improve our developer documentation.