I was using the strlen function from msvcrt.dll in a .Net 3.5 project. More specifically:
private unsafe static extern int strlen( byte *pByte );
After migrating to .NET 4.0, if I use this function it throws a PInvokeStackImbalance exception.
How can I import the .NET 3.5 msvcrt.dll or fix this exception?
I suspect that the problem is with the calling convention, you should be using Cdecl.