I am having some troubles to load a DLL in a Windows console application I am coding for a class project.I don't know why it doesn't load the library file.
Before I call LoadLibrary where I have the error, I define this before main:
#include "lomo2.h"
and
HINSTANCE cargaDLL;
Also I have tried changing HINSTANCE to HMODULE type but it is useless.
After that in main I try to import the DLL that is located in main:
cargaDLL = LoadLibrary("C:\\lomo2.dll");
if (cargaDLL == NULL){
PERROR ("Error en la carga de la libreria\n");
Sleep(2000);
exit (1);
}
When I call LoadLibrary I have also tried to use a relative path like "LoadLibrary(.\my dll directory\lomo2.dll)" but it doesn't work at all.
The result is the message where it says there has been an error while linking the library, in PERROR.
Checking the error with GetLastError() it says it cannot find the specified module.
I hope you can help me to solve this problem. Thnaks.
GetLastError(). Windows will tell you the problem. - drescherjmlomo2.dllmay depend on another DLL, and that other DLL is missing. - Raymond Chen