Re: Why are non-const typemaps matching const parameters?

Lindley French <[email protected]> Sun, 17 Oct 2021 10:41:46 -0700
Newsgroups gmane.comp.programming.swig
Message-ID <CALwtg07sjb_ATOmJwX0yUPhTcK=RcCByrq3RcJj6MQh6ii-GJQ@mail.gmail.com>
Ah, so it turns out SWIG strips qualifies when trying to find a matching
typemap. We need to intercept that by providing empty-string argout
typemaps for the const types.



On Sun, Oct 17, 2021 at 10:02 AM Lindley French <[email protected]> wrote:

> I'm trying to make it so that argout typemaps are only applied to
> non-const parameters. On a function F(const T*) I want only the in typemap
> for T; on a function G(T*) I want both the in and argout typemaps for T.
>
> I'm doing this:
>
> %typemap(in) TYPE {...}
> %typemap(argout) OUTPUT_TYPE {...}
>
> %apply TYPE { T&, T*, const T&, const T* }
> %apply OUTPUT_TYPE { T&, T* }
>
> However, I can see in the generated code that the argout typemap is being
> used for the const T* case. What's going on and how can I fix it?
>

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