如何用C#调用这个C++dll的函数
extern "C" PB_RESULT __declspec(dllexport)CRDR_ReadData(OUT char* lpBuffer, IN DWORD dwBufferSize,
OUT DWORD
lpNumberOfBytesRead)
WriteLog4("[CRDR_ReadData]dwBufferSize=%d",dwBufferSize);
if (m_crdr.m_ptrarrayCardInfo.GetSize()>0)
CARD_INFO *pCardInfo = NULL;
pCardInfo = (CARD_INFO
)m_crdr.m_ptrarrayCardInfo.GetAt(0);
int nLenth = strlen(pCardInfo->cardno)+1;
//DWORD dLen = nLenth + 1;
memcpy(lpBuffer,pCardInfo->cardno,nLenth);
*lpNumberOfBytesRead = nLenth-1;
if (pCardInfo != NULL)
delete pCardInfo;
m_crdr.m_ptrarrayCardInfo.RemoveAt(0);
WriteLog4("[CRDR_ReadData]lpBuffer=%s,nLenth=%d",lpBuffer,*lpNumberOfBytesRead);
return PB_OK;
0
提建议
当前问题酬金
¥ 0 (可追加 ¥500)
支付方式
扫码支付
4 条回答 默认 最新
-
zzkjliu 2015-05-04 04:18关注
P/Invoke C++ Interop
本回答被题主选为最佳回答 , 对您是否有帮助呢? 本回答被专家选为最佳回答 , 对您是否有帮助呢? 本回答被题主和专家选为最佳回答 , 对您是否有帮助呢?举报按下Enter换行,Ctrl+Enter发表内容