typemap for std::string results in uncompilable wrapper

Prashanth P S <[email protected]> Thu, 1 Sep 2022 03:16:47 +0000
Newsgroups gmane.comp.programming.swig
Message-ID <BM1PR01MB34435F5505E7741E52AA96C49B7B9@BM1PR01MB3443.INDPRD01.PROD.OUTLOOK.COM>
Hi,

I am defining a typemap for handling std::string reference args.

%typemap(in) std::string & INPUT (std::string str) {
    STRLEN len;
    const char * value = SvPV((SV *)$input, len);
    if (len > 0) {
        str.assign(value, len);
    }
    $1 = &str;
}

However this results in an error at compile time:
test_wrap.cc:2382:11: error: ‘res2’ was not declared in this scope
     if (SWIG_IsNewObj(res2)) delete arg2;

I verified that res2 has not been defined in the wrapper code. Is there something incorrect with the typemap definition ? Please suggest.

Perl: v5.8.9
Swig: v3.0.12

Warm Regards,
Prashanth PS

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