Note that there are some explanatory texts on larger screens.

plurals
  1. POMarshalling char arrays in Struct for windows CE
    text
    copied!<p>How would one marshal the char arrays in the following struct definition? in the .Net CompactFramework (For Windows CE)</p> <p>//Struct of request for transaction</p> <pre><code>typedef struct _VXN_REQUEST { char DID [33]; char MID [33]; char TID [33]; char ClientRef [33]; char Payload [8192]; ULONG PayloadLength; } VXN_REQUEST, *LPVXN_REQUEST; </code></pre> <p>I tried to Marshal it like this but it doesn't seem to work</p> <pre><code> [StructLayout(LayoutKind.Sequential,CharSet=CharSet.Auto)] public struct VXN_REQUEST { [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 33)] public string DID; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 33)] public string MID; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 33)] public string TID; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 33)] public string ClientRef; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 33)] public string Payload; public uint PayloadLength; } </code></pre> <p>Also Tried like This but none of them works, the native code is taking it as a single char instead.</p> <pre><code>[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct VXN_REQUEST { [MarshalAs(UnmanagedType.ByValArray, SizeConst = 33)] public char[] DID; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 33)] public char[] MID; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 33)] public char[] TID; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 33)] public char[] ClientRef; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 33)] public char[] Payload; public uint PayloadLength; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload