[問題] C# 使用C產生的DLL
目前已完成:
1. 已使用C在a專案產生DLL,並且在b專案(cpp)載入並使用
2. 在專案c(c# form)裡加入a專案的dll
[DllImport("Win32Project2.dll", EntryPoint = "Add")]
public static extern int Add(int a, int b);
3. 直接點c專案的.exe (dll也放在一起) 可以正常執行
問題:
用偵錯模式(F5)跑到dll中的function時會出現以下錯誤:
Managed Debugging Assistant 'PInvokeStackImbalance'
has detected a problem in
'D:\test_code\WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.vshost.exe'.
wsFormsApplication1.vshost.exe'
Additional information: 對 PInvoke 函式 'WindowsFormsApplication1!
我應該是載入成功了但為何只有debug模式會出錯呢? 懇請各位大大賜教
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 118.166.182.8
※ 文章網址: https://www.ptt.cc/bbs/C_Sharp/M.1449552654.A.71D.html
→
12/08 21:51, , 1F
12/08 21:51, 1F
→
12/08 22:35, , 2F
12/08 22:35, 2F
推
12/09 10:44, , 3F
12/09 10:44, 3F
討論串 (同標題文章)
以下文章回應了本文:
完整討論串 (本文為第 1 之 2 篇):
C_Sharp 近期熱門文章
PTT數位生活區 即時熱門文章