I tried to use the example as shown here to pass it to rust as a *mut MyStruct and I'm not too sure if it's because of the nature of the Struct or simply due to extern semantics in C#, but I was able to edit the values in rust, but they were not copied back into C#. On the other hand, the following did work but requires me to use unsafe code in C#:
var Output = new MyStruct[100];
unsafe
{
fixed(MyStruct* ptr = Output)
{
my_rust_function((IntPtr)ptr);
}
}
I tried to use the example as shown here to pass it to rust as a
*mut MyStruct
and I'm not too sure if it's because of the nature of the Struct or simply due to extern semantics in C#, but I was able to edit the values in rust, but they were not copied back into C#. On the other hand, the following did work but requires me to use unsafe code in C#: