[gdal-dev] Suggested new typemap for the bindings

Even Rouault even.rouault at spatialys.com
Thu May 21 09:07:03 PDT 2015


Ari,

I regenerated the Python bindings and I'm now spammed with messages like the 
following that cause the tests to fail:

$ python vsifile.py
  TEST: vsifile_1 ... swig/python detected a memory leak of type 'VSI_RETVAL 
*', no destructor found.
swig/python detected a memory leak of type 'VSI_RETVAL *', no destructor 
found.
swig/python detected a memory leak of type 'VSI_RETVAL *', no destructor 
found.
fail
    line 96: failure
[...]

It looks like

 %{
 /* use this to not return the int returned by GDAL */
 typedef int RETURN_NONE;
+/* return value that is used for VSI methods that return -1 on error (and set 
errno) */
+typedef int VSI_RETVAL;
 
 %}

is not sufficient and we would need to instanciate typemaps for this in the 
Python bindings ? I hate SWIG... I'm afraid other languages might have similar 
issue

Even

> I defined a new type VSI_RETVAL to be used instead of int with VSI
> functions that return -1 in error and set errno.
> 
> For the Perl bindings I defined two typemaps for this type. One which
> strips the return value and one which throws an error if the return
> value is -1. The error is strerror(errno).
> 
> I think this improves the usability of those VSI functions from the
> binded languages.
> 
> Ari
> 
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list