I'm trying to link into a dll explicitly or dynamically and my code could not find the dll. This code is taken from wikipedia for testing. Could anyone tell me what am I doing wrong? I'm using VSC++ 2005.
#include <windows.h>
#include <stdio.h>
#include <winbase.h>
// DLL function signiture
typedef double (*importfunction)(double, double);
int main(int argc, char **argv)
{
importfunction addNumbers;
double result;
// Load DLL File
HMODULE hinstLib = LoadLibrary((LPCWSTR)".Example.dll");
if(hinstLib == NULL)
{
FreeLibrary(hinstLib);
printf("Error: unable to find DLL functionn");
return 1;
}
result = addNumbers(1, 2);
FreeLibrary(hinstLib);
printf("The result was: %fn", result);
return 0;
}
I appriciate the help
Oh, by the way, some of you may think that it should be HINSTANCE instead of HMODULE; But HMODULE is also type defined as HINSTANCE under winbase.h