Re: changing signature of function with ignore/rename

William S Fulton <[email protected]> Thu, 14 Jul 2022 19:02:04 +0100
Newsgroups gmane.comp.programming.swig
Message-ID <CANGqftASN+VQ3wkCYcP8zo1iyUxQVssgpbnO5XyY4Ew00v3eog@mail.gmail.com>
Put the %extend A { ... } before the %ignore A::get.

William

On Wed, 6 Jul 2022 at 15:14, <[email protected]> wrote:

> 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
>

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