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

拥有回忆 提交于 2019-12-01 01:01:20

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.

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!