i want to call some functions from a DLL(which is provided by a hardware manufacturer without the .lib and .def). I've used these following code
Expand|Select|Wrap|Line Numbers
- HINSTANCE hinstLib;
- MYPROC ProcAdd=NULL;
- BOOL fFreeResult, fRunTimeLinkSuccess = FALSE;
- // Get a handle to the DLL module.
- hinstLib = LoadLibrary(TEXT("C:\My.dll"));
- // If the handle is valid, try to get the function address.
- if (hinstLib != NULL)
- {
- std::cout<<"loaded\n";
- ProcAdd = (MYPROC) GetProcAddress(hinstLib, "funcinDLL");
- // If the function address is valid, call the function.
- if (NULL != ProcAdd)
- {
- fRunTimeLinkSuccess = TRUE;
- (*ProcAdd) ();
- }
- // Free the DLL module.
- fFreeResult = FreeLibrary(hinstLib);
- }
- // If unable to call the DLL function, use an alternative.
- if (! fRunTimeLinkSuccess)
- printf("Message printed from executable\n");
can anyone suggest me , how can i do the job?