Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
OptimisticPeach opened this issue Jul 25, 2019 · 0 comments
Open

Comments

@OptimisticPeach
Copy link

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);
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant