We have some interop code that involves matrices. I was trying to call the native DLL and for the most part it works very reliably.
I am relying on the default marshalling by .net, avoiding unmanaged pointers and rather using .net arrays for the most part, and maybe a byref
here and there. The .net article says, that multidimensional arrays are implicitly marshalled as column-major one-dimensional arrays, which would be fine.
The only thing that does not seem to work, is trying to marshal a multi-dimensional array, as the F# compiler complains that float[,]
is not allowed in an extern
declaration. Is there any way around this limitation?
I am aware of the PinnedArray
and PinnedArray2
types from the F# PowerPack, but I was looking for a solution which relies on managed pointers and - more importantly - I'd like to avoid having to include F# PowerPack as a dependency just for the PinnedArray
classes.