#include "stdafx.h"
#include “IGDLogbk.h”
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
在DLLMAIN所在的文件,添加导出函数
GDLOGBK_API IGDLogbk* APIENTRY CreateIGDLogbk()
{
return new CGDLogbk();
}
GDLOGBK_API void APIENTRY DestroyIGDLogbk(IGDLogbk* pIGDLog)
{
if (pIGDLog)
{
//pIUsb->ReleaseUsb();
//delete pIUsb;
//pIUsb = NULL;
}
}
IGDLogbk.h:
#ifndef _IGDLOGBK_H_
#define _IGDLOGBK_H_
//dll导出类
//dll跟其使用者共用的头文件
#pragma once
// defined with this macro as being exported.
#ifdef GDLOGBK_EXPORTS
#define GDLOGBK_API __declspec(dllexport)
#else
#define GDLOGBK_API __declspec(dllimport)
#endif
class IGDLogbk
{
public:
virtual void GDInitParam(int nLevel) = 0;
virtual BOOL GDWriteLog(int nLevel, const TCHAR* format, ...) = 0;
virtual void Release() = 0;
};
extern "C" GDLOGBK_API IGDLogbk* _stdcall CreateIGDLogbk();
//extern "C" GDLOG_API void _stdcall DestroyIGDLog(IGDLog* pIGDLog);
#endif