I\'m writing a GUI application, using Qt, which links to a third-party DLL that sometimes sends error messages to stderr. I\'d like these error messages to be displayed in a
There is only one stderr, so my guess is that the problem is not that you need to load the dll dynamically, but somewhere in your redirection code. Your redirection code is written Linux style, where in windows things work differently.
if you could test your application on Linux, It would help to pin point the problem. If it works on Linux, that it is surly the redirection code.
Anyway, you should read some more about redirection and windows, as I don't think that what you are trying to do now will help you.
Does the DLL really write to stderr
? Or does it write to GetStdHandle(STD_ERROR_HANDLE)
? The first maps to the second, initially. But with freopen()
you merely change the mapping. Anything written to STD_ERROR_HANDLE
will still go there.
To redirect everyones error output, you would need SetStdHandle.