redeexpressos
compile-time `IntrPtr` size for union-like structs with `FieldOffset`
hi. im developing a FFI in Rust in order to allow C# code to call methods from it.
im running through an low-level issue, but maybe there is a solution.
What I want to represent is something like:
so my idea was to represent this as the following in C#:
however, there is a issue.
IntPtr
size can differ on different architectures, which means my memory alignment offsets are wrong.
I've tried [FieldOffset(4)]
but compiler does not like it.
Is there a good solution for this?20 replies