I wrote a VC ++ dll. The declaration for one of the methods in the dll is as follows:
extern "C" _declspec(dllexport) void startIt(int number) { capture = cvCaptureFromCAM(number); }
I use this dll in C # code using P / Invoke. I am making the announcement as follows:
[DllImport("Tracking.dll", EntryPoint = "startIt")] public extern static void startIt(int number);
and I call the function in code like:
startIt(0);
Now that this line is encountered, the compiler throws me this error:
A call to PInvoke function 'UsingTracking!UsingTracking.Form1::startIt' 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 cannot understand why this throws this error, since the signature in the managed and unmanaged code is the same. Moreover, on my other machine, the same code works fine in a visual studio. Thus, it makes me think that the error that the error throws is wrong.
Please, help.
thanks
c # dll visual-c ++ pinvoke
Jayesh
source share