一个应用程序中的__pioinfo的多个实例(单线程) [英] multiple instance of __pioinfo in one application (single thread)
问题描述
我的应用程序具有多个__pioinfo,一个用于应用程序,另一个用于动态链接到的DLL. 应用程序通过 fd = _dup(1),freopen("tmp",..,stdout)重定向标准输出,并使用_dup2(fd,1)将其还原.
最后,当DLL试图关闭stdout时,它会出错(错误的句柄).
我的问题:在同一个单线程应用程序中具有__pioinfo []的两个实例是否正确? 否则,如何解决或避免它?
请您提供一些代码来重现此问题吗?您可以在此处发布代码或将您的项目上传到 skydriver
不必发送整个项目.我们只需要一个最简单的示例即可重现该问题.您可以从中删除任何机密信息或业务详细信息.
最好的问候,
Jesse
My aplication has multiple __pioinfo, one for the application and the other for the DLL which is dynamically linked into. The application redirects stdout by fd =_dup(1), freopen("tmp", .., stdout), and restores it using _dup2(fd, 1).
At the end, when DLL tries to close stdout, it gets error (wrong handle).
My question: is it correct to have two instances of __pioinfo[] in the same single-threaded application ? If not, how to fix it or avoid it ?
Hello,
Would you please provide us some codes to reproduce this issue? You can post codes here or upload your project to skydriver
It is not necessary that you send out the whole of your project. We just need a simplest sample to reproduce the problem. You can remove any confidential information or business details from it.
Best regards,
Jesse
这篇关于一个应用程序中的__pioinfo的多个实例(单线程)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!