The result of MemHandleNew is not something you can dereference with the *
operator. Instead, take the result of MemHandleLock and cast it to a (Bar*). And
pass *that* pointer to new().
-- Keith Rollin
-- Palm OS Emulator engineer
"Maarten L. Hekkelman" <[EMAIL PROTECTED]> on 12/09/99 01:11:17 PM
Please respond to [EMAIL PROTECTED]
Sent by: "Maarten L. Hekkelman" <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
cc: (Keith Rollin/HQ/3Com)
Subject: ::new(p) Foo;
Can anyone explain to me why this code generates a Privilage violation when
executing the new operator?
#include <Pilot.h>
#include <new>
void Foo ();
class Bar
{
public:
Bar () : mValue (0) {}
private:
long mValue;
};
void Foo ()
{
Bar **b = (Bar**)::MemHandleNew(sizeof(Bar));
::MemHandleLock((VoidHand)b);
::new(*b) Bar;
::MemHandleUnlock((VoidHand)b);
}
I really thought this was valid code...
-maarten
--
Maarten L. Hekkelman http://www.hekkelman.com
Hekkelman Programmatuur bv mailto:maarten at hekkelman.com