Arrays of CTypes Memory Layout

I’ll ignore all C# part since I assume all C<->C# is your own thing.

There’s not really much conversion. You can just pass an array to a C function that accept a pointer and the function will get the pointer to the data. You cannot resize this way, obviously, since a pointer does not carry that information and I’ll assume that you don’t need it. (you basically have to call into julia in order to resize arrays)

You can’t, if you are talking about the array to the data anyway. If you get the pointer from the method above (ccall(..., (Ptr{Cvoid}, ...), array, ...)) it’s just the pointer to the array and you can’t get any array metadata from there. You can get the pointer to jl_array_t as well but I don’t think you need to do that.

Yes/no, see above.

Who said that? No the array layout has always been C-like. And the pointer you get in the method above has always been giving you the pointer to the data.

2 Likes