【VC开源代码栏目提醒】:网学会员VC开源代码为您提供ex1.cpp参考,解决您在ex1.cpp学习中工作中的难题,参考学习。
// ex1.cpp : Defines the entry point for the DLL application.
//
#include "stdafx.h"
#include "ex1.h"
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
num = 100; //在dll被加载时,赋全局变量为100
break;
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
int add(int x, int y)
{
return x + y;
}
int sub(int x, int y)
{
return x - y;
}