1
我有一個C#的COM對象wtitten,我在C++ dll中使用它。c#COM對象&「ESP的值沒有正確地保存在一個函數調用...」
C++中的COM對象導入與#import
derective
的問題是,當呼叫從一個C++ DLL作出了COM對象的任何功能,我得到一個運行時檢查錯誤:
Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention.
在用C++導入指令產生的COM對象的包裝,所有函數聲明爲__stdcall
可能重複http://stackoverflow.com/questions/4104774/the-value- of-esp-was-not-saved-properly) – 2012-03-22 11:08:00
這是COM調用非常不尋常的問題,調用約定和參數類型都是機器生成的。您需要更好地描述代碼,至少需要發佈C#聲明和C++調用的片段。簡單的解釋是你使用的是舊版本的類型庫。 – 2012-03-22 11:14:45
它看起來像我找到了解決方案: i'v declated In/Out/MarshalAs屬性的所有方法和參數在C#COM – ili 2012-03-22 11:38:45