[net.micro.mac] NewHandle/MemError in Modula-2

dtw@cmu-cs-k.ARPA (Duane Williams) (03/25/85)

I am having trouble using desk accessories from Modula-2.  Inside Mac suggests
checking whether sufficient memory is available before trying to load desk
accessories.  After determining the size of the desk accessory resource, one
is supposed to call NewHandle and then check whether it returns NIL.  If it
does then there isn't room for the desk accessory; otherwise there is.  I've
had no trouble with this when using SUMacC, but it doesn't work from Modula-2.

The trouble seems to be that NewHandle does not always return NIL when it
should, and sometimes returns NIL when it shouldn't.  It behaves differently
depending on whether my program is run by double-clicking its icon on the
desktop or whether I run it using the Execute item in the Transfer menu in
the Linker.  A different interpreter is used in the two cases!  (This is
obviously a big mistake.)

I've tried using MemError after calling NewHandle, hoping that MemError
would give more reliable status information, but MemError appears to be
broken also.  It should return either NoErr (0) or MemFullError (-108).
Instead it returns various values, depending on how I execute my program,
but seldom returns the correct value.  Sometimes it returns 18, which is
(suspiciously) the value of MemoryManagerModNum.

Have other people had better luck using NewHandle and MemError from Modula-2?
-- 
uucp: ..!seismo!cmu-cs-k!dtw
arpa: dtw@cmu-cs-k.ARPA