Skip to content

C# Arrays example only allows for data to flow in one direction. #87

Open
@OptimisticPeach

Description

@OptimisticPeach

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);
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions