= !PerlSwig = == To re-SWIG Mapscript with a different version of SWIG == : (currently (<=3.6, 3.7?) distributed with 1.1) cd mapscript/perl swig -perl5 -shadow mapscript.i (thanks Steve Lime) Then build as usual. [Thu Mar 6 16:04:11 EST 2003] Jason Thaxter notes that the README note for perl says to use SWIG Version 1.1 (Build 883), but that didn't work, while version 1.3.17u (current release) seems to create a working module, though with a number of warnings about deprecated SWIG tags... Patch required to eliminate mod_perl & strict fatal errors http://mapserver.gis.umn.edu/data2/wilma/mapserver-users/0205/msg00068.html or a direct link to the SWIG archives http://mailman.cs.uchicago.edu/pipermail/swig/2000-March/001227.html Offsite discussion redarding the use of null strings as file names {{{ > Steve Lime writes: > > Um, yup it is. Simply switching: > > > > if (arg1->name) free((char*)arg1->name); > > arg1->name = (char *) malloc(strlen(arg2)+1); > > strcpy((char*)arg1->name,arg2); > > > > to: > > > > if (arg1->name) free((char*)arg1->name); > > if(arg2) { > > arg1->name = (char *) malloc(strlen(arg2)+1); > > strcpy((char*)arg1->name,arg2); > > } else > > arg1->name = NULL; > > > > Seems to fix things. Now, how to get these changes made? > > > > This is probably being controlled by a typemap in Lib/swig.swg. > I'll take a look. > }}} You can try sticking this in your interface (or making mods in swig.swg). Cheers, Dave {{{ !#perl /* Default typemap for handling char * members */ #ifdef __cplusplus %typemap(memberin) char * { if ($1) delete [] $1; if ($input) { $1 = ($1_type) (new char[strlen($input)+1]); strcpy((char *) $1,$input); } else { $1 = 0; } } %typemap(memberin,warning="451:Setting const char * member may leak memory.") const char * { if ($input) { $1 = ($1_type) (new char[strlen($input)+1]); strcpy((char *) $1,$input); } else { $1 = 0; } } %typemap(globalin) char * { if ($1) delete [] $1; if ($input) { $1 = ($1_type) (new char[strlen($input)+1]); strcpy((char *) $1,$input); } else { $1 = 0; } } %typemap(globalin,warning="451:Setting const char * variable may leak memory.") const char * { if ($input) { $1 = ($1_type) (new char[strlen($input)+1]); strcpy((char *) $1,$input); } else { $1 = 0; } } #else %typemap(memberin) char * { if ($1) free((char*)$1); if ($input) { $1 = ($1_type) malloc(strlen($input)+1); strcpy((char*)$1,$input); } else { $1 = 0; } } %typemap(memberin,warning="451:Setting const char * member may leak memory.") const char * { if ($input) { $1 = ($1_type) malloc(strlen($input)+1); strcpy((char*)$1,$input); } else { $1 = 0; } } %typemap(globalin) char * { if ($1) free((char*)$1); if ($input) { $1 = ($1_type) malloc(strlen($input)+1); strcpy((char*)$1,$input); } else { $1 = 0; } } %typemap(globalin,warning="451:Setting const char * variable may leak memory.") const char * { if ($input) { $1 = ($1_type) malloc(strlen($input)+1); strcpy((char*)$1,$input); } else { $1 = 0; } } #endif }}} ---- back to PerlMapScript