While translating some C# code into F# I noticed some unexpected behavior with structlayout.
Having
type MyType =
struct
val a: int
end
is fine, but having
open System.Runtime.InteropServices
[<type:StructLayout(LayoutKind.Sequential, Pack=1)>]
type LayoutType =
struct
val a: int
end
results in an error:
error FS0193: internal error: Could not load type 'LayoutType' from assembly 'FSI-ASSEMBLY, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' because field 'a@' was not given an explicit offset.
Setting Pack=0 and everything is fine.
I tried this out in VS2013 and VS2015 CTP 6, and the results are identical.
/@kasperhj
While translating some C# code into F# I noticed some unexpected behavior with structlayout.
Having
is fine, but having
results in an error:
Setting
Pack=0and everything is fine.I tried this out in VS2013 and VS2015 CTP 6, and the results are identical.
/@kasperhj