arrayfire / arrayfire-haskell

Haskell bindings to ArrayFire
http://hackage.haskell.org/package/arrayfire
BSD 3-Clause "New" or "Revised" License
59 stars 5 forks source link

Fix joinMany #56

Closed twesterhout closed 1 year ago

twesterhout commented 1 year ago

Instead of allocating an array of pointers, joinMany was allocating memory for just one pointer. This was making ArrayFire read out of bounds and fail with various errors.

This commit fixes this issue by adding a helper withManyForeignPtr function that acts like withForeignPtr (not unsafeWithForeignPtr!), but for a list of ForeignPtrs.

dmjio commented 1 year ago

Thank you for fixing these bugs ! allocaArray /withArrayLen is definitely the right way to go.

af_err af_join_many(af_array *out, const int dim, const unsigned n_arrays, const af_array *inputs);