When working on wrappers for the FFTW library I encountered several
problems that may require some sort of hacks ...
1. How to wrap an open C array with fix dimensionality by a Modula-3
array?
libfftw provides a function to allocate memory at SIMD friendly memory
locations. I like to use this function and wrap the pointer to the C array
by a Modula-3 open array. It would be nice if this array could also be
traced by the Garbage collector. Of course I want to use as little
knowledge about the internals of open arrays as possible, so I searched
the RT (runtime) modules of m3core for a function that does the wrapping.
But I didn't found one.
2. How to handle arrays of arbitrary dimensions?
The functions RTType.GetNDimensions and RTHeap.GetArrayShape let me hope
that it is possible to manage arrays of arbitrary dimension by REFANY
arguments. But how can I check the index and field type of an ARRAY type?
How to wrap the allocation function described above to work with arrays of
arbitrary dimension? I think the wrapper needs a TypeCode argument to be
able to create arrays of a type that the main program knows of.