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

📄 vecdll.h

📁 一个可以实现导出stl标准摸版类的一个动态链接库的实现
💻 H
字号:

// The following ifdef block is the standard way of creating macros which make exporting 
// from a DLL simpler. All files within this DLL are compiled with the VECDLL_EXPORTS
// symbol defined on the command line. this symbol should not be defined on any project
// that uses this DLL. This way any other project whose source files include this file see 
// VECDLL_API functions as being imported from a DLL, wheras this DLL sees symbols
// defined with this macro as being exported.
#ifdef VECDLL_EXPORTS
#define VECDLL_API __declspec(dllexport)
#define EXPIMP_TEMPLATE
#else
#define VECDLL_API __declspec(dllimport)
#define EXPIMP_TEMPLATE extern
#endif

#include <vector>

// This class is exported from the vecDll.dll
class VECDLL_API CVecDll {
public:
	CVecDll(void);
	// TODO: add your methods here.
};


//导出stl类 std::vector<CPerson>
class CPerson
{
public:
	int m_nAge;
	char m_strName[40];
public:
    bool operator < (const CPerson& c) const
    {
        return m_nAge < c.m_nAge;
    }
    bool operator == (const CPerson& c) const
    {
        return m_nAge == c.m_nAge;
    }
};
EXPIMP_TEMPLATE template class VECDLL_API std::vector<CPerson>;
VECDLL_API int fnVecDll(std::vector<CPerson>& vecPer);


//导出包含stl类数据成员的类 CContainer
EXPIMP_TEMPLATE template class VECDLL_API std::vector<int>;
class VECDLL_API CContainer
{
public:
	std::vector<int> m_vecNum;
};

⌨️ 快捷键说明

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