[gdal-dev] GIntBig in the bindings

Ari Jolma ari.jolma at gmail.com
Fri May 22 06:21:31 PDT 2015


22.05.2015, 12:44, Even Rouault kirjoitti:
> Le vendredi 22 mai 2015 10:46:05, vous avez écrit :
>> 22.05.2015, 11:38, Ari Jolma kirjoitti:
>>> It seems that there are quite a few interface methods with two
>>> versions where the only difference is whether GIntBig is used or not.
>>> Also some methods do not have GIntBig when they actually should use it
>>> since it is in the GDAL API.
>>>
>>> I found out that at least in Swig Perl default typemaps have long long
>>> and unsigned long long. Thus using GIntBig should mostly be just the
>>> case of saying
>>>
>>> %apply (long long) { GIntBig };
>>>
>>> At least Python, Java and CSharp seem to have default typemaps for
>>> long long and unsigned long long.
>>>
>>> However, what GIntBig really is, is a configure time decision. That
>>> should be somehow propagated to the bindings.
>> I must also say that we're loosing (have lost?) the benefit of having a
>> single set of "language independent" interface files because of all the
>> #ifdefs in them. It might be easier to have only separate sets and then
>> manually copy paste and edit when new things are added.
> I don't know. We have the possibility to clear incrementally the .i file as
> soon as we identify that some features can be supported by all languages.
>
> Regarding the GIntBig case, as it seems that the 4 languages officially
> supported (Java, Python, CSharp, Perl) have the in/out typemaps for GIntBig we
> can probably remove the #ifdef stuff. (Ruby has no such typemaps, but since we
> removed it from the makefiles, we don't have to care anymore)

The yesterday's solution to use %apply for VSI_RETVAL was probably not 
the best one.

I think a more correct way would be to simply say

typedef int VSI_RETVAL;

also outside %{ %}'s to make it known for swig that VSI_RETVAL is an int 
and it can be treated as an int by default. That is the same way we can 
make GIntBig known to swig.

It seems I knew this already since I made many changes like that in my 
github fork of gdal. I also made a pull request.

https://github.com/OSGeo/gdal/pull/48

Since GIntBig is possibly used in all bindings I think we need a new 
interface file gdal_typedefs.i, which is included by all.

I'll work on this on github.

Ari

>
>
>> Ari
>>
>>> Ari
>> _______________________________________________
>> gdal-dev mailing list
>> gdal-dev at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/gdal-dev



More information about the gdal-dev mailing list