未施用调试信息生成二进制文件
未使用调试信息生成二进制文件
typedef int (_stdcall *UC)(BYTE *pCmd,int *parg0,int *parg1,int *parg2);
void CClientDlg::OnReadIdcard()
{
//加载动态库
HMODULE Hdll = LoadLibrary(_T("RdCard.dll"));
HMODULE hSdll = LoadLibrary(_T("sdtapi.dll"));
HMODULE hWdll = LoadLibrary(_T("WltRS.dll"));
UC uc = (UC)GetProcAddress(Hdll,"UCommand1");
BYTE *pCmd;
const char pC[] = "0x41";
pCmd = (unsigned char*)malloc(sizeof(pC));
memcpy(pCmd,pC,sizeof(pC));
//初始化端口
int init = uc(pCmd,0,0,0);
//这句出错了,查看堆栈信息
显示[下面的框架可能不正确和/或缺失,没有为 RdCard.dll 加载符号]
//释放
FreeLibrary(Hdll);
//释放内存空间
free(pCmd);
}
我己经将RdCard.dll放到Debug目录下了,请大神指教
------解决方案--------------------
没有符号文件(pdb),这要是很正常的。
你现在出问题不是因为没有调试信息了,而是崩溃了!
当然你有调试信息的话,就比较好分析它是怎么崩的。
------解决方案--------------------
uc函数调用出错了,
UC uc = (UC)GetProcAddress(Hdll,"UCommand1");
if(uc)
判断一下是否为空
typedef int (_stdcall *UC)(BYTE *pCmd,int *parg0,int *parg1,int *parg2);
void CClientDlg::OnReadIdcard()
{
//加载动态库
HMODULE Hdll = LoadLibrary(_T("RdCard.dll"));
HMODULE hSdll = LoadLibrary(_T("sdtapi.dll"));
HMODULE hWdll = LoadLibrary(_T("WltRS.dll"));
UC uc = (UC)GetProcAddress(Hdll,"UCommand1");
BYTE *pCmd;
const char pC[] = "0x41";
pCmd = (unsigned char*)malloc(sizeof(pC));
memcpy(pCmd,pC,sizeof(pC));
//初始化端口
int init = uc(pCmd,0,0,0);
//这句出错了,查看堆栈信息
显示[下面的框架可能不正确和/或缺失,没有为 RdCard.dll 加载符号]
//释放
FreeLibrary(Hdll);
//释放内存空间
free(pCmd);
}
我己经将RdCard.dll放到Debug目录下了,请大神指教
DLL
------解决方案--------------------
没有符号文件(pdb),这要是很正常的。
你现在出问题不是因为没有调试信息了,而是崩溃了!
当然你有调试信息的话,就比较好分析它是怎么崩的。
------解决方案--------------------
uc函数调用出错了,
UC uc = (UC)GetProcAddress(Hdll,"UCommand1");
if(uc)
判断一下是否为空