Re: [問題] 關於呼叫C++ dll function的問題

作者: a911zip (a911zip)   2014-09-30 11:56:04
你可以試用 宣告 MarshalAs(UnmanagedType.LPArray)] byte[] intput 再宣告 byte[] outlist 丟入 看看
※ 引述《whatbb123 (灣灣)》之銘言:
: 各位大大好
: 我利用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#型別是錯誤的嗎?
: 麻煩各位先進了
: 謝謝!

Links booklink

Contact Us: admin [ a t ] ucptt.com