[gdal-dev] C API, pointers vs lists in functions prototypes
Francesco P. Lovergine
frankie at debian.org
Sun Dec 24 09:40:27 PST 2023
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
--
Francesco P. Lovergine
More information about the gdal-dev
mailing list