还是error LNK2019 问题,没解决

rxaliao 2009-06-05 09:35:45
我写了一个DLL,里面有一个函数HRESULT DllPlay(wchar_t* wcsURL);
我在应用程序中使用这个DLL的函数,应用程序原来用非UNICODE编译时,Build Debug和Build Realease都没问题。但是我的应用程序改为UNICODE编译后,Build Debug正常,Build Realease会出现以下的错误:

error LNK2019: unresolved external symbol "__declspec(dllimport) long __cdecl DllPlay(unsigned short *)" (__imp_?DllPlay@@YAJPAG@Z) referenced in function "public: void __thiscall CDemoListDlg::OnBnClickedButtonPlay(void)" (?OnBnClickedButtonPlay@CDemoListDlg@@QAEXXZ)


应用程序中使用这个DLL的其他函数(参数是int或long或void)则没问题.如调用DllInitRadio正常.
应用程序中调用代码如下:

#pragma comment(lib, "NetRadioDll")
__declspec(dllimport) HRESULT DllInitRadio(HWND hDlg, RECT rcClient);
__declspec(dllimport) HRESULT DllPlay(wchar_t* wcsURL);

struct ProgramInfo{
long lnum;
wchar_t url[256];
};

BOOL CDemoListDlg::OnInitDialog()
{
.........

HRESULT hr = DllInitRadio(this->m_hWnd, rcClient);
}

void CDemoListDlg::OnBnClickedButtonPlay()
{
......

DllPlay(programInfo.url); //programInfo.url
}
...全文
125 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
rxaliao 2009-06-05
  • 打赏
  • 举报
回复
解决了,greatws 说对了。原来我在DLL工程里的trait wchar_t as build-in type设置为YES,应用程序里trait wchar_t as build-in type设置为NO.统一过来就可以了
rxaliao 2009-06-05
  • 打赏
  • 举报
回复
是改DLL那边还是改应用程序那边?
greatws 2009-06-05
  • 打赏
  • 举报
回复
声明改成这样试试,有可能是编译那个dll的时候,把wchar_t作为u_short了
__declspec(dllimport) HRESULT DllPlay(unsigned short* wcsURL);
na_he 2009-06-05
  • 打赏
  • 举报
回复
DllPlay(programInfo.url);参数有问题了,强制转化一下,或者使用其定义需要的类型

15,467

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 进程/线程/DLL
社区管理员
  • 进程/线程/DLL社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧