|
From: Petr N. <Pet...@am...> - 2006-10-24 18:42:57
|
Thanks a lot, I am checking your recommendation. Interesting note: To use that, I must artificially make A::~A public, even= though it is intentionally hidden (private) in the original class design.= Without a public destructor, delete_A is not generated and %unrefobject= has nothing to apply to. I guess it's a feature... although I can imagine= that an explicit %unrefobject should trigger delete_A generation. BTW, I still think I did exactly what 10.5.9 asks me to do. But I see what= you mean: The "newfree" is supposed to free the pointer that the called= function supposedly allocated by the invoking function; the %newobject= does not belong there - it applies only when the returned pointer is= wrapped as a pointer (and it tells target language whether it owns the= object the pointer points to) and not if the returned value is translated= to a native type. Ergo, I think 10.5.9 has two problems - it is confusing= about purpose of newfree and incorrect about usage of %newobject. Regards, -- Petr Novotn=FD Prague Development Center, AMDOCS +420266773112, +420608711517 "First Law of Bad Management: If something isn't working, do more of it." -= Tom DeMarco=0D > -----Original Message----- > From: John Lenz [mailto:jl...@ma...]=0D >=0D > On 10/23/06 10:45, Petr Novotny wrote: > > Hi, > >=0D [snip] > > After reading the documentation, I thought that I am supposed to > > inform swig by %newobject that B::test creates a new object, and by > > %typemap(newfree) A* how A should be dispatched of.=0D >=0D > No, the newfree typemap is for freeing temporary memory created during > the typemap, that is used to build the real return value. You should > instead try using > %unrefobject A "A::recycle($this)" [huge snip] >=0D > John >=0D >=0D This message and the information contained herein is proprietary and= confidential and subject to the Amdocs policy statement, you may review at http://www.amdocs.com/email_disclaimer.asp |