title: Do we have to marshall unsigned long?
body: <p>The API I am using has something like this:</p>
  
  <pre><code>int simpletran(LPSTRUCT req)
  {
      printf("%d", req-&gt;length);
  }
  
  typedef unsigned long ULONG;
  
  typdef struct _st {
    ULONG length;
  }STRUCT, *LPSTRUCT;
  </code></pre>
  
  <p>My C# version of it:</p>
  
  <pre><code>[DllImport(LINUXLIB, CallingConvention=CallingConvention.Cdecl)]
  public static extern simpletran(STRUCT req);
  
  class STRUCT
  {
    public UInt32 length;
  }
  STRUCT st = new STRUCT();
  st.length = (UInt32)100;
  simpletran(st);
  </code></pre>
  
  <p>When I call the unmanaged function I get some long negative values like -31245665!!!</p>
  
  <p>I am using C# mono on a Linux machine.</p>