[foreign] Pointer to fixed-size array: is jexctract's mapping to Java correct?
Lev Serebryakov
lev at serebryakov.spb.ru
Wed Feb 27 15:18:20 UTC 2019
I'm playing with same libfftw native library and latest (I'm swear! It
is 44!) EA build.
If we strip all preprocessor stuff (which is used to generate 3
versions of library) from fftw3.h, we get:
```
typedef double fftw_complex[2];
fftw_plan_dft_1d(int n, fftw_complex *in, fftw_complex *out, ...);
```
So, second and third parameters for `fftw_plan_dft_1d()` is pointer to
array of size 2. In C it is effectively a... pointer! As any pointer to
array, it collapses to single pointer-to-type and not
pointer-to-pointer-to-type.
But jextract maps it to `Pointer<Array<Double>>`. Is it correct?
Shouldn't it be `Pointer<Double>` nor `Array<Double>`?
It is not clear to me, why do I need another layer of indirection in
Java and how to properly get such pointer-to-array when I have
`Array<Double>` at hands, to be sure, that it will be correctly mapped.
--
// Black Lion AKA Lev Serebryakov
More information about the panama-dev
mailing list