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: QuickDraw GX Environment and Utilities /
Chapter 6 - Message Manager / Message Manager Reference
Functions / Allocating Memory for and Disposing of Global Data


NewMessageGlobals

You can use the NewMessageGlobals 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
The NewMessageGlobals 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 the A5Size function and the aProc parameter is the A5Init function. The A5Size and A5Init functions are both Macintosh Programming Workshop (MPW) library routines. The A5Size function determines how much memory is to be allocated for the A5 world. The A5Init 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 the DisposeMessageGlobals 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.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996