[問題] 關於呼叫C++ dll function的問題
各位大大好
我利用c#寫網頁並呼叫c++ dll檔裡的function
在dll裡function裡的變數為PBYTE與ULONG
如下(以下是一行,為了方便閱讀我把它切了一下):
extern "C" __declspec(dllexport)void
GetAuthString(PBYTE pInBuf, ULONG ulInSize);
然後我利用c#寫成的網頁接了一字串
字串名稱暫且稱AuthStr = "477-61-F3-43A-46B-32E-589-4C4-4BD"
並試著傳入GetAuthString中
[DllImport("AuthProc.dll", EntryPoint = "GetAuthString",
CallingConvention = CallingConvention.Cdecl)]
static extern int GetAuthString(
byte[] pInBuf,
UInt32 ulInSize
);
先載入dll檔後,再將參數個別填入
其中pInBuf必須帶入AuthStr
ulInSize 為字串長度
我試著將string轉型後代入function中
但結果仍失敗。。。
是因為c++對應的c#型別是錯誤的嗎?
麻煩各位先進了
謝謝!
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 1.171.51.98
※ 文章網址: http://www.ptt.cc/bbs/C_Sharp/M.1412003530.A.494.html
推
09/30 02:26, , 1F
09/30 02:26, 1F
→
09/30 02:28, , 2F
09/30 02:28, 2F
→
09/30 08:28, , 3F
09/30 08:28, 3F
→
09/30 09:44, , 4F
09/30 09:44, 4F
→
09/30 09:44, , 5F
09/30 09:44, 5F
→
09/30 09:46, , 6F
09/30 09:46, 6F
討論串 (同標題文章)
C_Sharp 近期熱門文章
PTT數位生活區 即時熱門文章