Re: SWIG/Euphoria
- Posted by David Cuny <dcuny at LANSET.COM> Aug 06, 2000
- 402 views
Lee West wrote: > Forgive MY C++ ignorance and incompetence as > well... but don't you need to "destroy" the "circle" and > "square" objects somewhere in the shapes.exw > demo? I should, but I just grabbed the code from the SWIG examples. There's no destructor in the Shapes class. If you added: ~Circle(); you would end up with a destructor method in the code. Since SWIG expects that it will create the objects. This ends up looking like this: #define delete_Circle(_swigobj) (delete _swigobj) extern "C" void __declspec(dllexport) _wrap_swig_delete_Circle(Circle *self) delete_Circle(self); } The problem is that SWIG is expecting that the object to be deleted is supposed to be a SWIG object. SWIG has a bunch of cool stuff that wraps the pointers, makes them typesafe, and so on. Of course, SWIG/Euphoria uses none of this. As a result, there's no delete() behavior defined. At least, I don't think so. If 'delete' is a legitimate way to destroy C++ objects, then everything is cool. If not, I'll need to take a look at how SWIG handles it internally, and see if I can duplicate it without the overhead. I was naively thinking I could write: #define delete _swigobj (~_swigobj) but I *really* doubt this would work. Anyone want to whack me with a cluestick here? Thanks! -- David "I don't know C" Cuny