I am currently running into an issue of calling an Win32 DLL[Native] from a C# windows application.
I have come so far.
C++ source:
extern "C" __declspec(dllexport) int PlaceSound(__in DWORD frequence, __in DWORD duration)
{
Beep(frequence, duration);
return 0;
}
C# source:
[DllImport("SampleLib.dll")]
public extern static int PlaceSound(int Freq, int Dura);
public form1 { InitializeComponements; PlaceSound(150, 500); }
Upon debugging, I recieve the sound, however, when the library returns its integer value I seem to get a pinvoke.
Pinvoke:
A call to PInvoke function 'SoundTracer!SoundTracer.Form1::PlaceSound' 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.
What am I doing wrong?