My problem: I have some functions in a DLL, some of these functions, for example:
#include <string>
using namespace std;
extern "C" __declspec(dllexport) string __cdecl encryption(string s)
{
return s;
}
Whenever I try to call this function from C #, here is the im code using:
[DllImport("Packer.dll", EntryPoint = "encryption")]
static extern string encryption(string s);
I get an error: PInvoke function call "Packer" has an unbalanced stack. This is likely due to the fact that the PInvoke managed signature does not match the unmanaged target signature. Verify that the calling agreement and PInvoke signature settings match the target unmanaged signature.
im guessing I get this error because I do not have the correct declarations for the function can anyone advise me how to fix this, thanks in advance
source
share