DEV Community

Discussion on: Calling Rust from C#

Collapse
 
dmitryvk profile image
Kalyanov Dmitry

You should annotate the structs (on the C# side) with [StructLayout(LayoutKind.Sequential)] - otherwise CLR is free to reorder fields or add/remove padding which will break ABI.

Collapse
 
living_syn profile image
Jeremy Mill

You're totally correct. I have that in the production code this is modeled after and I forgot it. I'll add it in, thanks!