i have a function defined as:

Code:
int functionCall (int index) {
    return index * 2;
}
I want to be able to load this up and run it but so i can load this function from different dlls (specified at run time).

I have used LoadLibrary, GetProcAddress etc to get all the details, the only problem is when wanting to call it.
Msdn uses:

Code:
typedef UINT (CALLBACK* LPFNDLLFUNC1)(UINT, DWORD);
to which i changed to:

Code:
typedef int (CALLBACK* LPFUNCTION)(int);
although when it comes to running my program this generates an error. my full code is:

Code:
#include <iostream.h>
#include <windows.h>

typedef int (CALLBACK* LPFUNCTION)(int);

HINSTANCE dllHandle;
LPFUNCTION dllFunction;

int main (void) {
                dllHandle = LoadLibrary("1.dll");
	if (dllHandle != NULL)
	{
		dllFunction = (LPFUNCTION)GetProcAddress(dllHandle, "functionCall");
		if (!dllFunction)
		{
			FreeLibrary(dllHandle);
			return -1;
		}
		else
		{
			cout << "DLL Function Loaded:" << dllFunction << endl;
			int uReturnVal = dllFunction(100);
			cout << "Return:" << uReturnVal << endl;
		}
	}

	return 0;
}