Will loading a DLL dynamically reconcile its stderr to a main application? If so, then how…?

后端 未结 2 1336
日久生厌
日久生厌 2021-01-06 19:24

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

相关标签:
2条回答
  • 2021-01-06 19:54

    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.

    0 讨论(0)
  • 2021-01-06 19:56

    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.

    0 讨论(0)
提交回复
热议问题