Important: The information in this document is obsolete and should not be used for new development.
NewMessageGlobals
You can use theNewMessageGlobals
function 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
TheNewMessageGlobals
function 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
msgGlobalsSize
parameter is theA5Size
function and theaProc
parameter is theA5Init
function. TheA5Size
andA5Init
functions are both Macintosh Programming Workshop (MPW) library routines. TheA5Size
function determines how much memory is to be allocated for the A5 world. TheA5Init
function 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
NewMessageGlobals
function by calling theDisposeMessageGlobals
function.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
DisposeMessageGlobals
function described in the next section.The prototype for the application-defined callback function for global data initialization is described on page 6-26.