OutputDebugStringA 在/CLR工程中调用的c++的dll竟然有输出失败的情况?
上层C#,调用底层的c++库,c#与c++的中间API接口工程可以输出__FILE__等,但是底层c++的库,无论如何都不输出
debugview应该没问题,其它消息一直在打印
OutputDebugStringA 换成OutputDebugStringW ,也不行
void DbgPrintString(const char* pFile, const char* pFun, const int line, const char* pFormat,...)
{
char arr[1000] = { 0 };
SYSTEMTIME sys;
GetLocalTime(&sys);
sprintf_s(arr, 25, "%4d-%02d-%02d %02d:%02d:%02d.%03d", sys.wYear,sys.wMonth,sys.wDay,sys.wHour,sys.wMinute, sys.wSecond,sys.wMilliseconds);
sprintf_s(&arr[23], sizeof(arr)-23, " %s %s:%d\n", pFile,pFun,line);
OutputDebugStringA(arr); 这条语句在底层库无论如何打印不出来
va_list pArgList;
va_start (pArgList, pFormat);
sprintf_s(arr,sizeof(arr),pFormat,pArgList);
va_end (pArgList);
OutputDebugStringA(arr); 这条可以打印pFormat的内容,但是通过pArgList传过来的参数全是错误的,不知道为什么
}
void LOG_DLL_EXPORT DbgPrintString(const char*pFile, const char* pFun, const int line, const char* pFormat,...);
#define DbgPrintStr(pFormat,...) DbgPrintString(__FILE__, __FUNCTION__, __LINE__, pFormat, ##__VA_ARGS__);
上面在/clr工程里面工作正常,但是纯c++工程的底层dll缺不正常。
请问问题出在哪里?