错误代码
BOOL C_AV_ImagePath(TCHAR* inpath,TCHAR* outpath)
{
BOOL bRet=false;
outpath=_T("\\Program Files\\Caputrue\\temp%d.bmp");
return bRet;
}
正确
C++
xxx.h
extern "C" __declspec(dllexport) BOOL C_AV_ImagePath(TCHAR* inpath,TCHAR* outpath);
xxx.cpp
BOOL C_AV_ImagePath(TCHAR* inpath,TCHAR* outpath)
{
BOOL bRet=false;
_tcscpy(outpath,_T("\\Program Files\\Caputrue\\temp%d.bmp"));
return bRet;
}
C#
[DllImport("Captrue.dll", EntryPoint = "C_AV_ImagePath")]
public static extern bool C_AV_ImagePath(string inpath,[Out] StringBuilder outpath);
bool brst = true;
string inpath="inpath":
StringBuilder outpath = new StringBuilder(200);
brst = Captrue.C_AV_ImagePath(inpath, outpath);