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