DLL问题
我把一个C/S MFC程序(应该说是两个,一个Client,一个Server)改写成DLL.
Client有由MFCAppWizard[DLL],选择regular dll. 并包含 WinSocket.新建类CClientSocket继承自CSocket文件名为:RemoteControl
我怎么改写呀. 我把一些自己编写函数: USBConnectServer(char* IP),USBInitialize(BYTE),USBStart(BYTE),USBUpdate(//若干参数)要导出来USBStop(BYTE);导出来.我把他们写在RemoteControl类里面,但是无法使用导出关键字,写成全局的时候,
CClientSocket *m_pSocket; //
LPCTSTR m_strServerName;//
UINT m_nPort;//
extern "C" __declspec(dllexport) BYTE USBConnectServer(char *IP);
extern "C" __declspec(dllexport) BYTE USBInitialize();
..........
当我在Cliaent里面写函数虚函数virtual void OnReceive(int nErrorCode)的时候,build的时候就会出错:
RemoteControl.obj : error LNK2005: "class CClientSocket * m_pSocket" (?m_pSocket@@3PAVCClientSocket@@A) already defined in ClientSocket.obj
RemoteControl.obj : error LNK2005: "char const * const m_strServerName" (?m_strServerName@@3PBDB) already defined in ClientSocket.obj
RemoteControl.obj : error LNK2005: "unsigned int m_nPort" (?m_nPort@@3IA) already defined in ClientSocket.obj
ClientSocket.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall CClientSocket::OnReceive(int)" (?OnReceive@CClientSocket@@UAEXH@Z)
Debug/RemoteControl.dll : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
不知何故.我想让各位高手帮忙看看这个到底怎么写.高位大侠多多帮忙