[Gdal-dev] C# Osr.GetProjectionMethodParameterList Access Violation

Diaren diarenwhan at yahoo.co.uk
Thu Jun 4 09:45:17 EDT 2009


Well I've learnt some swig and possibly solved the problem, can someone
verify that this ok and maybe turn this into a proper patch or someting was
against 1.6.0:

typemaps_csharp.i
+244:

%typemap(argout) (char **staticstring)
{
  /* %typemap(argout) (char **staticstring) */
  *$1 = SWIG_csharp_string_callback(*$1);
}

osr.i:
-229:
%rename (GetProjectionMethodParameterList) OPTGetParameterList;
%apply (char **CSL) {(char **)};
char **OPTGetParameterList( char *method, char **username );
%clear (char **);

%rename (GetProjectionMethodParamInfo) OPTGetParameterInfo;
void OPTGetParameterInfo( char *method, char *param, char **usrname,
                          char **type, double *defaultval );

+229:
%rename (GetProjectionMethodParameterList) OPTGetParameterList;
%apply (char **CSL) {(char **)};
%apply (char **staticstring) {(char **username)};
char **OPTGetParameterList( char *method, char **username );
%clear (char **);
%clear (char **username);

%rename (GetProjectionMethodParamInfo) OPTGetParameterInfo;
%apply (char **staticstring) {(char **usrname), (char **type)};
void OPTGetParameterInfo( char *method, char *param, char **usrname,
                          char **type, double *defaultval );
%clear (char **usrname);
%clear (char **type);


Diaren wrote:
> 
> Problem is I don't know the first thing about how swig works... and If I
> modify the OPTGetParameterList to use CPLStrdup or something, then that
> will cause problems for other code which knows Username is a static string
> and doesn't need freeing.
> 
> So any swig experts that can modify the generated wrapper to not free
> arg2? or is OPTGetParameterList supposed to allocate the string passed
> back through Username?
> 

-- 
View this message in context: http://n2.nabble.com/C--Osr.GetProjectionMethodParameterList-Access-Violation-tp3024324p3024796.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.



More information about the gdal-dev mailing list