Important: The information in this document is obsolete and should not be used for new development.
NewMessageGlobals
You can use theNewMessageGlobalsfunction to request and allocate memory for globals.
OSErr NewMessageGlobals (long msgGlobalsSize, MessageGlobalsInitProc aProc);
msgGlobalsSize- The size of the memory requested for global data.
- aProc
- A pointer to an application-defined callback function that initializes and allocates global data memory.
- function result
- An error of type
OSErr indicating that the requested memory allocation could not be completed.DESCRIPTION
TheNewMessageGlobalsfunction sets up a global world for your printing extension or printer driver. This consists of allocating the specified amount of memory and initializing it with the passed procedure. Once you have created a global world, you can access your data just as you would if your printing extension or printer driver were an application. Whenever your extension or driver is called, your data will be valid.To establish an A5 world for your globals, the
msgGlobalsSizeparameter is theA5Sizefunction and theaProcparameter is theA5Initfunction. TheA5SizeandA5Initfunctions are both Macintosh Programming Workshop (MPW) library routines. TheA5Sizefunction determines how much memory is to be allocated for the A5 world. TheA5Initfunction takes a pointer to the A5 globals and initializes them to the appropriate values.When your extension or printing driver no longer needs the globals, you should release the memory allocated by the
NewMessageGlobalsfunction by calling theDisposeMessageGlobalsfunction.SEE ALSO
Global data and the A5 world are discussed in the sections "Global Data Storage for Printing Extensions and Printer Drivers" beginning on page 6-7 and "Allocating Memory for and Disposing of Global Data" beginning on page 6-8.To dispose of printing extension and printer driver globals, use the
DisposeMessageGlobalsfunction described in the next section.The prototype for the application-defined callback function for global data initialization is described on page 6-26.