[mapserver-dev] SWIG - perl array -> char **

Alex Rice alex_rice at arc.to
Sat Aug 10 01:14:21 EDT 2002


I think I found a problem in the the SWIGing of some functions in 
Perl mapscript. I am using the  msProcess*Template() functions 
from perl mapscript. The function returns

Type error in argument 3 of mapObj_processTemplate. Expected 
charPtrPtr. at /Library/Perl/darwin/mapscript.pm line 2674.

I think argument 3 is the array of tagNames. Here is the calling 
perl code:

my @tagNames = keys(%tags);
my @tagValues = values(%tags);
my $res = $mapObj->processTemplate($mapscript::MS_TRUE,
                                    \@tagNames,
                                    \@tagValues,
                                    $#tagNames + 1);

The SWIG configuration is for this function is:

char *processTemplate(int bGenerateImages, char **names, char 
**values, int numentries) {
       return msProcessTemplate(self, bGenerateImages, names, 
values, numentries);
}

We are missing in mapscript.i needs some special typemap setup to 
be able to transform a perl array into char **.  See "Converting 
a Perl5 array to a char **" at 
http://www.swig.org/Doc1.1/HTML/Perl5.html#n14

I was going to try to try this out and patch mapserver.i myself, 
but I don't have SWIG. Also I've never used SWIG before and it's 
a pretty big scary looking package. Anyways what version of SWIG 
are you all running?

P.S.  the same problem seems to apply to processLegendTemplate() 
and processQueryTemplate();

Alex Rice, Software Developer
Architectural Research Consultants, Inc.
alex_rice at arc.to
alrice at swcp.com





More information about the mapserver-dev mailing list