I am working on C ++ software that runs on all versions of Windows between Windows XP and Windows Vista. In my code, I developed a DLL that references a standard library ( Qt library ). Once my software is deployed, it is not unusual for a user to not have the same Qt build on his system, but in a slightly different configuration. Functions can be disabled there (therefore, their assembly Qt does not export the same character set), or the library can even be modified in ways that make the binary library incompatible with the original.
At some point, I load my DLL through a call to LoadLibrary (). This pulls any Qt library into the user system. If I'm lucky, their Qt build is compatible with what I used to design my DLLs, so LoadLibrary () completed successfully. However, depending on the changes made to their Qt assembly, calling LoadLibrary () sometimes fails with
- "The specified module was not found."; this usually happens if their Qt build consists of less DLLs than my Qt build. Therefore, my DLL is trying to load, for example. QtFoo.dll, but since this dll is not part of their Qt assembly, loading my DLL does not work.
- "The specified procedure was not found."; this usually happens if they change their Qt structure, so some functions are disabled, which leads to fewer exported characters.
My question is: how can I catch these errors gracefully? That's right, I just use GetLastError () and then print one of the two messages above. However, it would be much more useful if I knew which module could not be found or which procedure was missing. I noticed that when starting the application in Explorer, which is associated with the missing DLL, the explorer manages to get a good "Application foo cannot be loaded because the necessary library blah.dll is missing". Maybe some API is available to get more information on why the call to LoadLibrary () failed?
c ++ windows plugins qt
Frerich raabe
source share