I got a warning from fxcop from the declararation of a struct.
the warning:
"Structures with explicit layout containing misaligned
fields cause crashes on 64 bit platforms"
the struct:
[StructLayout(LayoutKind.Explicit)]
public struct STRRET
{
[FieldOffset(0)]
public UInt32 uType; // One of the STRRET_* values
[FieldOffset(4)]
public IntPtr pOleStr; // must be freed by caller of GetDisplayNameOf
[FieldOffset(4)]
public IntPtr pStr; // NOT USED
[FieldOffset(4)]
public UInt32 uOffset; // Offset into SHITEMID
[FieldOffset(4)]
public IntPtr cStr; // Buffer to fill in (ANSI)
}
Iam now wondering how to fix this potential problem without loosing union
semantics of the struct.
anyone some ideas?