⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dynclass.h

📁 动态加载C++类的演示,程序需要在调试状态运行,通过Debug输出,不错的学习例子
💻 H
字号:
#ifndef __DYNCLASS_H
#define __DYNCLASS_H

#include <windows.h>

#ifdef _DLL // assume this is defined when we build the dll
#define _DYNLINK __declspec( dllexport)
#else
#define _DYNLINK __declspec( dllimport)
#endif

class _DYNLINK CMyClass
{ 
public:
			CMyClass ();

	virtual	~CMyClass();

	void	DoSomethingUseful();
};

typedef void ( CMyClass::*PMYCLASSMETHOD)();

#ifndef _DLL
typedef CMyClass* ( *PFNCREATEMYCLASS)();
#else
_DYNLINK CMyClass* CreateMyClass() 
{ 
	return ( new CMyClass());
}
#endif

#ifndef _DLL
typedef void ( *PFNDELETEMYCLASS)( CMyClass*);
#else
_DYNLINK void DeleteMyClass ( CMyClass* pObj) 
{ 
	delete pObj;
}
#endif

#ifndef _DLL
typedef PMYCLASSMETHOD ( *PFNGETCLASSMETHOD)();
#else
_DYNLINK PMYCLASSMETHOD GetClassMethod () 
{ 
	return &CMyClass::DoSomethingUseful;
}
#endif



#endif	//	ndef __DYNCLASS_H

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -