I am trying to dynamically link my DLL to an application, but I am facing a problem when linking the DLL, can you please help.
My dll header file “MyDllHeader.h” is:
In my application logic is:
class A : public CObject
int ACCUAPI FunctionX();
int ACCUAPI FunctionY(TCHAR FAR * ParamA );
The “hinstlib” returns a value and it is not null, so this means that I managed to load the DLL, but when I call the “GetProcAddress” function to get the address of the function which is in the DLL, it returns null. Kindly help me.
typedef int (*MYPROC)();
// Get a handle to the DLL module.
// in the debugging this handler gets a value (i.e. not null)
hinstLib = LoadLibrary(TEXT("Mydll.dll"));
if (hinstLib != NULL)
// in the debugging “ProcAdd” returns null
ProcAdd = (MYPROC) GetProcAddress(hinstLib, TEXT("FunctionX "));
// If the function address is valid, call the function.
if (NULL != ProcAdd)
// do something