[foreign] Pointer to fixed-size array: is jexctract's mapping to Java correct?

Lev Serebryakov lev at serebryakov.spb.ru
Thu Feb 28 13:18:49 UTC 2019


On 28.02.2019 0:37, Maurizio Cimadamore wrote:

> And, more to the point, let's assume the API was defined differently, e.g.
> 
> typedef struct fftw_complex { double real; double img; }
> 
> Would you be surprised if jextract generated an API that said
> Pointer<fftw_complex> ? I have a suspicion that you might be less
  Yes, I will not be surprised at all, but it will be awful API from
Java side, as we don't have value types yet, and any Java code which
want to use FFT (or CBLAS, for this matter) NEED to store arrays of
complex numbers as twice-as-big arrays of doubles, or it will be
hopelessly slow.

> surprised by that choice, but in reality what would happen would be the
> same - and to allocate something you can pass to the API you would still
> do something very very similar to the code I've shown earlier - with the
> only difference that, instead of allocating an array in the loop, you
> would be allocating a struct (and then you'd have to set the struct
> fields).
> 
> Am I completely off track?

-- 
// Black Lion AKA Lev Serebryakov



More information about the panama-dev mailing list