title: Marshal managed string[] to unmanaged char**
body: <p>This is my c++ struct (Use Multi-Byte Character Set)</p>
  
  <pre><code>typedef struct hookCONFIG {
      int threadId;
      HWND destination;
  
      const char** gameApps;
      const char** profilePaths;
  } HOOKCONFIG;
  </code></pre>
  
  <p>And .Net struct</p>
  
  <pre><code>[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
  public struct HOOKCONFIG {
      public int threadId;
      public IntPtr destination;
  
      // MarshalAs?
      public string[] gameApps;
  
      // MarshalAs?
      public string[] profilePaths;
  }
  </code></pre>
  
  <p>I got some problem that how do I marshal the string array?
  When I access the struct variable "profilePaths" in C++ I got an error like this:</p>
  
  <blockquote>
    <p>An unhandled exception of type 'System.AccessViolationException' occurred in App.exe</p>
    
    <p>Additional information: Attempted to read or write protected memory. This is often an 
    indication that other memory is corrupt.</p>
  </blockquote>
  
  <pre><code>MessageBox(0, cfg.profilePaths[0], "Title", MB_OK); // error ... Orz
  </code></pre>