首先,新建 Test_cpp_define.h 頭文件。
#PRagma once# ifndef Test_CPP_API# ifdef Test_CPP_DLL# define Test_CPP_API __declspec(dllexport)# else# define Test_CPP_API __declspec(dllimport)# endif# else# define Test_CPP_API# endif在Dll 編譯項(xiàng)中定義宏 Test_CPP_DLL ,在需要導(dǎo)出 的類前 添加 Test_CPP_DLL 即可。
例如:
class Test_CPP_API CMarkDataMng完整導(dǎo)出類 代碼如下:
#pragma once#include "../Test_cpp_define.h"class CMarkData;class Test_CPP_API CMarkDataMng{ public: private:} 這即為 導(dǎo)出類頭文件,在 需要引用的程序中包含此頭文件即可. 是不是 So Easy 呀!~~~~~~~~~
新聞熱點(diǎn)
疑難解答
圖片精選
網(wǎng)友關(guān)注