www.pudn.com > DLLMAIN.rar > dlltest.cpp, change:2010-11-21,size:617b


// dlltest.cpp : Defines the entry point for the console application. 
// 
 
#include "stdafx.h" 
#include "windows.h" 
 
typedef int (__cdecl  *mydllfuncsum)(int a,int b); 
mydllfuncsum appmytestfuncsum; 
int _tmain(int argc, _TCHAR* argv[]) 
{ 
 
	int Mytestvar; 
	char Mytestchar[10]={0}; 
	HINSTANCE HInst; 
	appmytestfuncsum=NULL; 
	HInst=LoadLibrary(L"dll.dll"); 
	if(HInst==NULL) 
	{ 
		//MessageBox(_T("error dll")); 
		printf("err dll"); 
		return 0; 
	} 
	appmytestfuncsum=(mydllfuncsum)GetProcAddress(HInst,"mydllfuncsum"); 
	printf("%d\r\n",appmytestfuncsum(9,9)); 
	FreeLibrary(HInst); 
	return 0; 
}