Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perl swig errorObj #4305

Closed
AndyColson opened this issue May 1, 2012 · 1 comment
Closed

perl swig errorObj #4305

AndyColson opened this issue May 1, 2012 · 1 comment
Assignees

Comments

@AndyColson
Copy link

I have perl somewhat like:

my $errObj = new mapscript::errorObj();
print $errObj->{message};

swig generates mapscript_wrap.c, generates this function:
XS(_wrap_errorObj_message_get) {
.... snip. ..
arg1 = (errorObj *)(argp1);
result = (char *)(char *) ((arg1)->message);
{
size_t size = 2048;
while (size && (result[size - 1] == '\0')) --size;
ST(argvi) = SWIG_FromCharPtrAndSize(result, size); argvi++ ;
}
... snip ...

This treats char[] as array, not as char*, and the perl code prints the error message and then lots of garbage.

I added this code to plmodule.i:

%typemap(out) char[ANY] {
$result = newSVpvn($1, strlen($1));
argvi++;
}

and it SEEMS to fix the problem. I'm new to swig and mapserver, so its just a guess. But its running, in production, right now.

@ghost ghost assigned sdlime May 1, 2012
@sdlime
Copy link
Member

sdlime commented May 8, 2012

Fixed in master branch. Closing... Steve

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants