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:Code:class A : public CObject { public: A(); virtual ~A(); 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.Code:#include "head.h" typedef int (*MYPROC)(); . . . void CTest2Dlg::OnOK() { HINSTANCE hinstLib; // 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 } } }



LinkBack URL
About LinkBacks


