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

📄 vecdll.cpp

📁 一个可以实现导出stl标准摸版类的一个动态链接库的实现
💻 CPP
字号:
// vecDll.cpp : Defines the entry point for the DLL application.
//

#include "stdafx.h"
#include "vecDll.h"

#pragma data_seg("ABC")
int nGlobalAge = 44;
#pragma data_seg()

BOOL APIENTRY DllMain( HANDLE 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;
}


// This is an example of an exported variable
VECDLL_API int nVecDll=0;

// This is an example of an exported function.
VECDLL_API int fnVecDll(std::vector<CPerson>& vecPer)
{
	CPerson person;
	person.m_nAge = 1;
	strcpy(person.m_strName, "ych1");
	vecPer.push_back(person);

	person.m_nAge = 2;
	strcpy(person.m_strName, "ych222");
	vecPer.push_back(person);

	person.m_nAge = 3;
	strcpy(person.m_strName, "ych3");
	vecPer.push_back(person);

	return 42;
}

// This is the constructor of a class that has been exported.
// see vecDll.h for the class definition
CVecDll::CVecDll()
{ 
	return; 
}

⌨️ 快捷键说明

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