[DiscordArchive] <@367784837370609664> how do I tell c# not to allign my structs?
[DiscordArchive] <@367784837370609664> how do I tell c# not to allign my structs?
Archived author: Maku • Posted: 2018-05-29T12:08:53.548000+00:00
Original source
<@367784837370609664> how do I tell c# not to allign my structs?
Archived author: Deleted User • Posted: 2018-05-29T12:09:15.422000+00:00
Original source
There’s the structlaypit annotsrion
Archived author: Deleted User • Posted: 2018-05-29T12:09:23.442000+00:00
Original source
Annotation
Archived author: Deleted User • Posted: 2018-05-29T12:09:32.790000+00:00
Original source
StructLayout
Archived author: Warpten • Posted: 2018-05-29T12:16:13.048000+00:00
Original source
<@128154136020647936> `[StructLayout(LayoutKind.Explicit)]` and decorate members with `[FieldOffset(x)]`
Archived author: Warpten • Posted: 2018-05-29T12:16:31.618000+00:00
Original source
It's `LayoutKind.Sequential` by default
Archived author: Maku • Posted: 2018-05-29T12:16:55.812000+00:00
Original source
Can't it just take the order of my fields?
Archived author: Maku • Posted: 2018-05-29T12:17:34.206000+00:00
Original source
and size of them?
Archived author: Deleted User • Posted: 2018-05-29T12:18:01.193000+00:00
Original source
That’s sequential
Archived author: Maku • Posted: 2018-05-29T12:18:12.168000+00:00
Original source
```
[StructLayout(LayoutKind.Sequential, Pack = 0)]
unsafe public struct Command {
public UInt32 id;
public UInt32 size;
public fixed char name[16];
public UInt32 virtualOffset;
public UInt32 virtualSegmentSize;
public UInt32 fileOffset;
public UInt32 fileSegmentSize;
}
```