Loading Dlls

I wrote this little bit of code to read functions from a dll without header files. However it is dirty and ugly does anyone have a better way of doing this. If so please make a suggestion.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <windows.h>
	HINSTANCE hinstDLL;
	typedef void(*blockXorFunction)(string&,string);
	typedef void(*teaEncodeFunction)(string,string,string&);
	typedef void(*teaDecodeFunction)(string,string,string&);
	typedef void(*fileReadFunction)(string,string&);	
	typedef void(*fileWriteFunction)(string,string);
	blockXorFunction blockXor(0);
	teaEncodeFunction teaEncode(0);
	teaDecodeFunction teaDecode(0);
	fileReadFunction fileRead(0);
	fileWriteFunction fileWrite(0);
		

void load()
{
	hinstDLL = LoadLibrary("adevlib.dll");
	teaEncode = (teaEncodeFunction)GetProcAddress(hinstDLL,"teaEncode");
	teaDecode = (teaDecodeFunction)GetProcAddress(hinstDLL,"teaDecode");
	fileRead = (fileReadFunction)GetProcAddress(hinstDLL,"fileRead");	
	fileWrite = (fileWriteFunction)GetProcAddress(hinstDLL,"fileWrite");	
	blockXor = (blockXorFunction)GetProcAddress(hinstDLL,"blockXor");	
}

void breakDLL()
{
	FreeLibrary(hinstDLL);
}
Topic archived. No new replies allowed.