title: Invoke method for dll in WindowsForms
body: <p>I have a dll which contains this function:</p>
  
  <pre><code>int __stdcall PrnText(char *printtext);
  </code></pre>
  
  <p>In Windows Forms i have this code to invoke the dll:</p>
  
  <pre><code>[DllImport("Printing.dll", EntryPoint = "PrnText", CharSet = CharSet.Ansi)]
  public static extern int PrnText(char *printtext);
  </code></pre>
  
  <p>When i call the function in C# code i get an error like this : " cannot cast string to char*</p>
  
  <pre><code>PrnText("Hello World");
  </code></pre>
  
  <p>What parameter should i give to PrnText() to make it work?</p>
  
  <p>Later edit:</p>
  
  <pre><code>  Parameter: printtext
    pointer to string containing text to be printed
  </code></pre>