changing signature of function with ignore/rename

<[email protected]> Wed, 6 Jul 2022 15:13:41 +0100
Newsgroups gmane.comp.programming.swig
Message-ID <[email protected]>
Hi all

 

Hi all

 

William added support for std::unique_ptr  a few days ago but I need to
support older SWIG for a while. Therefore I'm trying to work-around it by
creating an equivalent function in the SWIG interface file that returns a
bare pointer that should replace the original. I have to ignore the original
function but would like to give the "replacement" function the same name.
Something like this

 

// original code has

std::unique_ptr<B> A::get();

 

// ignore to avoid error with unique_ptr

%ignore A::get;

%include "A.h"

 

%newobject A::get;

%extend A

  {

    // replacement

    B* get()  { return self->get().release();  }

  }

 

This works when my replacement function has a different name. Unfortunately
the %ignore for the original function, means that my replacement function
gets ignored as well.

 

Any suggestions?

 

Kris

_______________________________________________
Swig-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/swig-user