Mengtao: I created a header file called "NewDeleteImpl.h" and included <new>
and copied the inline forms of new/delete
posted as the second solution in your article to this header file. Then I
included  "NewDeleteImpl.h" to a source file called "CFieldInfo.cpp" where I
use "new" and "delete". All the old messy link errors are gone but I got a
new link error:

Link Error   : CFieldInfo.cpp: '__unexpected' referenced from 'operator
delete[](void*)' is undefined.

Seems to me the "__unexpected" is a global which is supported by shared lib.
But where is it and  how to get rid of it since I already deleted
PalmOSRuntime_2i_A5.lib from my project and the "NewDeleteImpl.h" should be
the only place I define new/delete. May I get your oppinion? Thank you!
__unexpected is a pointer that's used to look for an "unexpected" exception. The problem is that the compiler doesn't know that MemPtrNew and MemPtrDelete can't throw exceptions. I think if you explicitly turn off exceptions in the C/C++ Language panel, you should be able to build without the reference to __unexpected. If it still happens, you have have to add a local prototype for the file that redeclares MemPtrNew/MemPtrDelete as having "throw ()" to tell the OS that they won't throw any exceptions.

--
Ben Combee <[EMAIL PROTECTED]>
CodeWarrior for Palm OS technical lead
Palm OS programming help @ www.palmoswerks.com

--
For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/

Reply via email to