For Perl, SWIG generates the following C++.  All I want is a way to change the bit in bold red to call my own function instead of call delete.  Surely, there must be a way to do this?

XS(_wrap_delete_AsnRoot) {
  {
    wrapper::AsnRoot *arg1 = (wrapper::AsnRoot *) 0 ;
    void *argp1 = 0 ;
    int res1 = 0 ;
    int argvi = 0;
    dXSARGS;

    if ((items < 1) || (items > 1)) {
      SWIG_croak("Usage: delete_AsnRoot(self);");
    }
    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_wrapper__AsnRoot, SWIG_POINTER_DISOWN |  0 );
    if (!SWIG_IsOK(res1)) {
      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_AsnRoot" "', argument " "1"" of type '" "wrapper::AsnRoot *""'");
    }
    arg1 = reinterpret_cast< wrapper::AsnRoot * >(argp1);
    delete arg1;



    XSRETURN(argvi);
  fail:

    SWIG_croak_null();
  }
}


On Mon, Dec 29, 2008 at 2:31 PM, John Ky <newhoggy@gmail.com> wrote:
Hello?  Anyone?

I need a way to tell SWIG that Perl and Python needs to delete my object by calling my function (eg. delete_Object(void *) ).

Thanks

-John


On Wed, Dec 24, 2008 at 5:02 PM, John Ky <newhoggy@gmail.com> wrote:
Hi,

Is there an equivalent of SWIG ruby's %freefunc for Perl and Python?

Thanks

-John