
I am using third part DLL to configure something:), I don’t have the code/rights to change that third party dll, and I am getting PInvoke error , when I am importing the dll like below:
[DllImport("XXXXXX.dll")]
public unsafe static extern BusinessObject configure(int iConnectTimeout_seconds, int iReadTimeout_seconds,
char[] sProtocol, object pLoggingStream, char[] sUserAgent, char** sError );
And the error what I was getting is :
“A call to PInvoke function 'sathish!CDLL.Cfunction::export' 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.”
I tried all the possible solution mentioned in the Internet. Unfortunately Nothing is working out for me.
Fortunately
once change the target framework to .NET 4 to .NET 3.5 it start working:)