title: Marshaling Char*. How to get all characters
body: <p>I'm trying to create a .net wrapper for a custom COM Interface.</p>
  
  <p>The Interface is defined like this in C++:</p>
  
  <pre><code>DECLARE_INTERFACE_(IDumpAsf, IUnknown)
  {
      STDMETHOD(get_UserParams) (THIS_
                  int *is_auto_start,
                  int *fileSize,         
                  int *packetSize,
                  char *baseName, 
                  char *filePath
               ) PURE;
  
      STDMETHOD(set_UserParams) (THIS_
                  int is_auto_start,
                  int fileSize,          
                  int packetSize,
                  char *baseName, 
                  char *filePath
               ) PURE;
  
      STDMETHOD(enable_Run) (THIS_
                  bool is_run
               ) PURE;
  };
  </code></pre>
  
  <p>And I have declared the interface like this in C#:</p>
  
  <pre><code>public interface IDumpASF
  {
  
      [PreserveSig]
      int get_UserParams(
          [Out] out int is_auto_start,
          [Out] out int fileSize,
          [Out] out int packetSize,
          [Out] out System.Sbyte baseName,
          [Out] out System.SByte filePath
          );
  
      [PreserveSig]
      int set_UserParams(
          [In] int is_auto_start,
          [In] int fileSize,
          [In] int packetSize,
          [In] string baseName,
          [In] string filePath
          );
  
      [PreserveSig]
      int enable_Run([In] bool a);
  
  }
  </code></pre>
  
  <p>An exsample of use is this:</p>
  
  <pre><code>int is_auto_start;
  int fileSize;
  int packetSize;
  SByte baseName;
  SByte filePath;
  
  IDumpASF dump = (IDumpASF)asfWriter;
  
  dump.get_UserParams(out is_auto_start, out fileSize, out packetSize, out baseName, out filePath);
  </code></pre>
  
  <p>I'm able to build and run the soulution, but I don't get how I'm suppose to get the all the characters for the baseName and filePath. When I send the SByte, it get the first character back, but how do I get the rest? I have tried several other types like Sbyte[], String, StringBuilder and IntPtr. Whenever I try to convert them into a string, I get an AccessViolationException. </p>
  
  <p>I bet there is some silly thing I have missed, but my patients is wearing thin here. </p>
  
  <p>Any help would be much appriciated!</p>
  
  <p>-Svein</p>