title: Strings in c++?
body: <p>My problem is , i have some functions in a DLL some of these functions are for example :</p>
  
  <pre><code>#include &lt;string&gt;
  using namespace std;
  extern "C" __declspec(dllexport) string __cdecl encryption(string s)
  {
   return s;
  }
  </code></pre>
  
  <p>Whenever i try to call this function from C# , here is the code im using :</p>
  
  <pre><code>[DllImport("Packer.dll", EntryPoint = "encryption")]
  static extern string encryption(string s);
  </code></pre>
  
  <p>i get an error :
  A call to PInvoke function 'Packer' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.</p>
  
  <p>im guessing i get this error because i dont have the right declarations for the function
  can anyone guide me how to fix that , thanks in advance</p>