dll.h
#ifdef DLL_HIDDevice
class _declspec(dllexport) CHIDDevice //导出类
#else
class _declspec(dllimport) CHIDDevice //导入类po
#endif
{
public:
DWORD GetConnectedDeviceNum(WORD vid, WORD pid);
}
dll.cpp
#define DLL_HIDDevice
#include "HIDDevice.h"
DWORD CHIDDevice::GetConnectedDeviceNum(WORD vid, WORD pid)
{
return deviceNum;
}
main.cpp
#include "dll.h"
#pragma comment(lib,"dll.lib")
CHIDDevice HID_Class;
int main (int argc, char* argv[])
{
HID_Class.GetConnectedDeviceNum(...);
}