[Gdal-dev] Guidelines for the typemap usage for the SWIG bindings

Ari Jolma ari.jolma at tkk.fi
Sat Apr 21 04:53:06 EDT 2007


I agree. If you can draft such an agreement that would be very welcome. 
I must say that I have a really hard time understanding what is going on 
in the swig bindings at any given place and time - somehow swig requires 
a perverse and a crooked way of thinking ;), not linear at all.

I used the #ifdef's you refer to below, as I did not know if the effect 
would be harmful for the other bindings or if they had such typemaps I 
was using/adding to the Perl bindings. BTW, that whole section is #if 
!defined(SWIGPYTHON) (!). I don't recall how I announced these things on 
the list, but I think my intention was that having the typemap applied 
for Perl only was only temporary solution.

Cheers,

Ari

Tamas Szekeres kirjoitti:
> Developers,
>
> Upon adding support for Band.GetRasterCategoryNames,
> Band.SetRasterCategoryNames to the SWIG interface I've realized the
> need of an agreement among the binding owners about the desired usage
> of the various typemaps. In the current implementation I cannot see an
> obvious direction. Actually it would be much easier if there were a
> common policy when %applying the typemaps on a particular member.
>
> In case of the typemap char** we could use for example
>
> %typemap() char **stringarray   for passing and returning arrays of 
> strings
> %typemap() char **argout  for mapping outbound string parameters
> and so on
>
> Currently it's quite a difficult task even to count how many different
> typemaps we have for char** particularly.
>
> Having an unique approach would ensure not require to implement
> various typemaps for the same purpose.
> In addition we should also remove the several inhouse solutions like:
>
> %rename (GetProjectionMethodParameterList) OPTGetParameterList;
> #if defined(SWIGPERL)
> %apply (char **free) {(char **)};
> %apply (char **argout) {(char **username)};
> #endif
> char **OPTGetParameterList( char *method, char **username );
> #if defined(SWIGPERL)
> %clear (char **);
> %clear (char **username);
> #endif
>
> Which is not too benefical for the other languages.
>
> I guess this kind of work - if needed - would require an RFC to have.
> But at first we should get together with the ideas which ones we
> should really keep, omit or replace.
>
> Best regards,
>
> Tamas
> _______________________________________________
> Gdal-dev mailing list
> Gdal-dev at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/gdal-dev


-- 
Prof. Ari Jolma
Geoinformaatio- ja paikannustekniikka
Geoinformation and positioning technology
Teknillinen Korkeakoulu / Helsinki University of Technology
POBox 1200, 02015 TKK, Finland
Email: ari.jolma at tkk.fi URL: http://www.tkk.fi/~jolma




More information about the Gdal-dev mailing list