[Mono-dev] mono-Interop with Native Libraries
Jonathan Pryor
jonpryor at vt.edu
Sat Sep 4 18:21:52 EDT 2010
On Fri, 2010-09-03 at 09:13 -0300, Rafael Teixeira wrote:
> The highest risk is that without the
> [StructLayout(LayoutKind.Sequential)] the compiler is free to
> rearrange the order of the fields to make things as compact as
> possible but obeying to the alignment requirements of the architecture
Never mind the C# compiler, the JIT could change the layout between
program runs! (Not that any JIT I know of _would_, but nothing that I
know of requires consistency between one program run and the next.)
For example, pointers are usually placed together and like-size fields
are coalesced; this could produce different layouts between 32-bit and
64-bit platforms (as 'int' could be intermixed with pointers on 32-bit
but won't be on 64-bit).
- Jon
More information about the Mono-devel-list
mailing list