title: Marshal a va_list
body: <p>I have the following code:</p>
  
  <pre><code>[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
  public delegate void PanicFuncDelegate(string str, IntPtr args);
  
  private void PanicFunc(string str, IntPtr args)
  {
      LogFunc("PANIC", str, args);
  }
  
  public void LogFunc(string severity, string str, IntPtr args)
  {
      vprintf($"[{severity}] "+ str,args);
  }
  
  [DllImport("libc.so.6")]
  private static extern int vprintf(string format, IntPtr args);
  </code></pre>
  
  <p>This prints to the console the messages correctly formatted. I want to retrieve the values from args to use them in my own logger.</p>
  
  <p>If I try to get the value of each pointer from the array in args (as suggested here: <a href="https://stackoverflow.com/questions/10361369/marshal-va-list-in-c-sharp-delegate">Marshal va_list in C# delegate</a>) I get segmentation fault.</p>
  
  <p>Any suggestions?</p>