3
I have two libraries, sph.dll
and mydll.dll
, and I try to load them using Loadlibrary as shown below:
HMODULE hlib = LoadLibrary("mydll.dll");
if(!hlib){
printf("error");
MessageBox(NULL, "Erro -> mydll.dll não encontrado." , "Erro IB5 Printer" , MB_ICONERROR | MB_OK);}
HMODULE chlib = LoadLibrary("sph.dll");
if(!chlib){
printf("error");
MessageBox(NULL, "Erro -> sph.dll não encontrado." , "Erro IB5 Printer" , MB_ICONERROR | MB_OK);}
The problem is that when I compile an error message arises saying that sph.dll
was not found. When I call sph.dll
first, mydll.dll
is not found. I am using the DEV-C environment to program.
What’s the problem here?
When do you compile? If the error happens at the time of compilation, it is because you are sending Linker to link to these libraries and there is something wrong either in the paths passed to Linker, or in your command line. Already with the command
LoadLibrary
, libraries are loaded at runtime, manually, without the need for Linker instructions. Please get more details about the problem.– Vinícius Gobbo A. de Oliveira
The error does not happen at build time, the error happens while running the program, it informs you that the dll was not found. Both dlls are in the same directory, which is the same directory as the executable.
– peregrinus
How are you sure the problem is that the second DLL was not found? Use the command
GetLastError
to identify what really happened. Documentation: https://msdn.microsoft.com/en-us/library/windows/desktop/ms679360%28v=vs.85%29.aspx Add the error to the question, please.– Vinícius Gobbo A. de Oliveira
Thank you, I did as you asked, the mistake is 998.
– peregrinus
This is an error code. Only serves to search for the error message.
– Vinícius Gobbo A. de Oliveira