ADC Home > Reference Library > Technical Q&As > Legacy Documents > Mac OS 9 & Earlier >

Legacy Documentclose button

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:

Missing Low Memory Globals


Q: I am getting a link error on my PowerPC application when I use the following low memory globals:

	LMGetHighHeapMark
	LMGetROMMapHandle
	LMGetStackLowPoint
	LMGetUnitTableEntryCount
	LMSetHighHeapMark
	LMSetROMMapHandle
	LMSetStackLowPoint
	LMSetUnitTableEntryCount

What is wrong? Is there a workaround?

A: Unfortunately, these globals didn't make it into the Interface library on PowerPC machines. This problem was discovered after InterfaceLib was frozen and in ROM. We are aware of the problem and it has been reported as a bug. The problem is that InterfaceLib is in ROM, so it's not as simple as shipping a new replacement library.

There is no good solution, but there is a workaround:

Create an external function in a file (say Extra.c) to access the low-mem yourself (from native code only), as shown below. When an updated library is released, you only have to remove the Extra.c.o file from your link command and relink your app, not recompile it.

Using LMGetUnitTableEntryCount as an example:

// File: Extra.c
// Add Extra.c.o to your PPCLink command line
// Later, when a .xcoff file is provided by Apple, replace it with that,
// and delete your Extra.c.o. file.
#if defined(powerc) || defined (__powerc)
pascal short LMGetUnitTableEntryCount()
{
	return *(short *)0x01D2;
}
#endif

[Jan 09 1997]


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.