[gdal-dev] C API, pointers vs lists in functions prototypes

Even Rouault even.rouault at spatialys.com
Sun Dec 24 09:51:50 PST 2023


Francesco,

I can't think of a drawback if you want to submit such a PR to use 
type[] style declaration of arrays

Even

Le 24/12/2023 à 18:40, Francesco P. Lovergine via gdal-dev a écrit :
> Hi, folks.
> I recently worked onto the current Perl binding for GDAL via modern 
> FFI, and
> discovered that a series of functions can cause segfaults of the Perl 
> interpreter
> due to the use of type* instead of type[] (sometimes type[6]) in 
> function prototypes taken from the C header file. While that's 
> perfectly the same in C, apparently it causes some oddities due to 
> confusion among SV and AV in the Perl internals.
>
> Unfortunately, the only way to deal with those prototypes in the Perl 
> binding seems reading the documentation and to manually override the 
> code that generates func bindings in Perl in order to replace pointers 
> with arrays, when due.
>
> Thinking about that, the whole issue could be valid potentially for other
> language bindings, so I wonder if it would make sense changing a bit 
> prototypes
> in GDAL to solve this issue at the source for any list (i.e. using 
> array notation
> when required). I could even propose a simple PR about that, if it 
> would help.
>
> Thanks
>
> The long story is here: https://github.com/ajolma/Geo-GDAL-FFI/issues/53
>
-- 
http://www.spatialys.com
My software is free, but my time generally not.



More information about the gdal-dev mailing list