www.pudn.com > CS_CALLAPI_20111018A.rar > USERAPIDLL.cpp, change:2011-10-18,size:1074b


// USERAPIDLL.cpp : Defines the entry point for the DLL application. 
// 
 
#include "stdafx.h" 
#include "USERAPIDLL.h" 
 
 
#ifdef _MANAGED 
#pragma managed(push, off) 
#endif 
 
BOOL APIENTRY DllMain( HMODULE 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; 
} 
 
#ifdef _MANAGED 
#pragma managed(pop) 
#endif 
 
// This is an example of an exported variable 
USERAPIDLL_API int nUSERAPIDLL=0; 
 
// This is an example of an exported function. 
USERAPIDLL_API int fnUSERAPIDLL(void) 
{ 
	return 42; 
} 
 
// This is the constructor of a class that has been exported. 
// see USERAPIDLL.h for the class definition 
CUSERAPIDLL::CUSERAPIDLL() 
{ 
	return; 
} 
 
USERAPIDLL_API int testadd(int a,int b) 
{ 
	return a+b; 
} 
USERAPIDLL_API int testminus(int a,int b) 
{ 
	if (a>b) 
	{ 
		return a-b; 
	} 
	else 
	{ 
		return b-a; 
	} 
}