Jason Dawes wrote:
> I get: Link Error   : Scripts.cpp: 'operator delete(void*)' 
> referenced from [the class destructor] is undefined.
> Why am I not getting an error for 'new' too?

Because the CW compiler puts a call to 'operator delete' in every
destructor, and then passes a secret parameter to the destructor to make
it either call operator delete (if the caller used 'delete') or to not
call it (for destruction of a stack or static object).

If you do a Disassemble, you'll see this line in every destructor:

        jsr       __dl__FPv

(__dl__FPv is the mangled name of operator delete.)  It does this from
within the destructor instead of having the caller call __dl__FPv
separately after the destructor.  I'd guess this is one of those C++
things that compilers can implement any way they want as long as it
yields the correct behavior.

You can probably work around this by defining a no-op version of
operator delete to satisfy the linker.

-slj-

Reply via email to