Issue with arguments passed to swig

Prashanth P S <[email protected]> Mon, 29 Aug 2022 05:30:54 +0000
Newsgroups gmane.comp.programming.swig
Message-ID <BM1PR01MB3443FFDCDB92910EFC1D60E49B769@BM1PR01MB3443.INDPRD01.PROD.OUTLOOK.COM>
Dear All,

I am working on migrating perl from v5.6.1 to v5.8.9. The swig version being used is v3.0.12. With the new version of perl I see that the swig wrapper compilation throws errors with respect to type mismatch. The errors are with functions that have “char *” or “bool” arguments.

For example:
CPP code:
void setParams(char *id, bool value) {
    char buf[30];
    snprintf(buf, 30, “user_%s”, id);
    ….
}

Perl code:
              my $feature = 3012;
              my $status = 1;
                setParams( $feature, $status);

I am guessing perl is interpreting the “$feature” as integer and the swig wrapper module which is expecting a “char *” throws argument type mismatch error at run time.

However the below line works:
                setParams( “$feature”, “$status”);

Since this code was working with perl 5.6.1. please share any thoughts on switching back to old behaviour (with newer version of perl) since similar issues exist in multiple parts of the legacy code.

Warm Regards,
Prashanth PS

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