Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Improving the dll missing error message

Tags:

c++

dll

qt

bonjour

I have a program written in QT that works just fine. However it has an indirect dependency on dnssd.dll since a dll loaded by the program uses bonjour. If bonjour is not installed on the machine running the program it will say

The program can't start because dnssd.dll is missing from your computer. Try reinstalling the program to fix the problem.

I'm not loading this dll via LoadLibrary or otherwise. I linked the binary against the stub so it's loaded automatically before int main.

Obviously reinstalling the program does not fix the problem. For me it clearly says I need to install bonjour, but for most users this is extremly cryptic.

I would rather have this error message be something more informative such as "Bonjour needs to be installed for this application to work properly, go to [insert-url-here] to download it."

Is there a way to detect when a dll fails to load loke this and give a better error message?

like image 461
vidstige Avatar asked Oct 12 '11 12:10

vidstige


1 Answers

Set it to delay load, then as early as possible (before you cause loading to happen), try to load it yourself (with LoadLibrary) and report the problem.

http://msdn.microsoft.com/en-us/library/151kt790.aspx

like image 200
Lou Franco Avatar answered Oct 19 '22 14:10

Lou Franco