SFML community forums

Bindings - other languages => DotNet => Topic started by: Spodi on May 26, 2010, 01:35:21 am

Title: Missing StructLayout Sequential for some events
Post by: Spodi on May 26, 2010, 01:35:21 am
I am not positive on this one, but it looks like the structs in Event.cs used inside of the Event struct (SizeEvent, JoyButtonEvent, etc) should have the StructLayout(LayoutKind.Sequential) attribute.
Title: Missing StructLayout Sequential for some events
Post by: Laurent on May 26, 2010, 09:24:52 am
Maybe, honestly I don't know .Net enough to have an opinion about this. But so far it have always worked like a charm.
Title: Missing StructLayout Sequential for some events
Post by: Spodi on May 26, 2010, 10:47:31 am
Since the Event struct is going between managed and unmanaged, and these structs are inside of that Event struct, I am quite sure that they are needed. I haven't had a problem with it, either, but its always better to be safe than sorry. In general, any struct you use for managed code should have the struct layout type not automatic since you never know what the compiler (or JIT) is going to do. Its always nice to have for reflection, too. ;)

So my opinion is add it just to be safe.
Title: Missing StructLayout Sequential for some events
Post by: Laurent on May 26, 2010, 10:57:05 am
Yep, I agree. I'll do that as soon as possible, thanks.
Title: Missing StructLayout Sequential for some events
Post by: Laurent on May 26, 2010, 07:05:35 pm
Done.