[comp.sys.mac.programmer] UnloadSeg

ewing@boulder.Colorado.EDU (EWING DAVID JAMES) (02/11/90)

The question is: how do free up a segment with only class methods in it?
One might expect 'UnloadSeg(CObject::Dispose);' to work, but it gives a
compile error.  There ought to be a way of taking the address of a method,
but I can't find it (yes, I've looked in the manual).  BTW, I could declare
a dummy function in each segment and use that function for the call to
UnloadSeg(), but it simply isn't elegant.

Dave Ewing
ewing@tramp.colorado.edu  (128.138.238.33)
..!hplabs!boulder!onecom!tyvax!iftech!dave (My Mac IIx running uupc & MacOS!)
AppleLink: D2408	  (D2408@applelink.apple.com)

cosc10s4@jane.uh.edu (A JETSON News User) (02/12/90)

In article <16831@boulder.Colorado.EDU>, ewing@boulder.Colorado.EDU (EWING DAVID JAMES) writes:
> The question is: how do free up a segment with only class methods in it?
> One might expect 'UnloadSeg(CObject::Dispose);' to work, but it gives a
> compile error.  There ought to be a way of taking the address of a method,
> but I can't find it (yes, I've looked in the manual).  BTW, I could declare
> a dummy function in each segment and use that function for the call to
> UnloadSeg(), but it simply isn't elegant.
> 
No, you can't take the address of a method directly. When you say
CObject::Dispose, you are referring to something accessed through the
method table.You could probably get the address by mucking with the method 
table some, but this is liable to break if they change the format. 
I'm currently using the dummy function method.
-- 

Dan Podwall
University of Houston
COSC10S4@jane.uh.edu