C# .exe プロジェクトをネイティブ Visual-C++ DLL に接続するのは初めてです。
単純な整数だけを渡す方法がわかりません。次のコードを実行すると、「PInvoke ... unbalanced the stack」に関するポップアップ エラーが発生します。
C++ DLL........
extern "C"
{
__declspec(dllexport) void start_frame_generation( int& test_num )
{
Console::WriteLine ("test_num = " + test_num );
}
C# .................................
[DllImport("Ultrasound_Frame_Grabber.dll")]
public static extern void start_frame_generation( ref int test_num );
private void VNGuideViewForm_Load(object sender, EventArgs e)
{
int test_num = 123;
start_frame_generation( ref test_num);
}