简体   繁体   English

使用AllocConsole()和编组的问题

[英]Problem using AllocConsole() and marshalling

I've got a C# application that calls a native C++ DLL (I control the source of both). 我有一个C#应用程序,该应用程序调用本机C ++ DLL(我控制两者的源代码)。 I've used AllocConsole() from the managed side, and then call into the native side. 我从托管方使用了AllocConsole(),然后调用了本机方。 But the native code won't output to the console- nothing happens, even though there is most definitely a console available, since I just explicitly allocated one. 但是本机代码不会输出到控制台-即使有绝对可用的控制台也不会发生任何事情,因为我只是明确分配了一个控制台。 The code works fine if I allocate a console before the first console output from the native code, but if I try to allocate a console during only some std::cout calls, then it fails. 如果我在本机代码的第一个控制台输出之前分配了一个控制台,则该代码运行良好,但是如果我尝试仅在某些std :: cout调用期间分配一个控制台,则它将失败。 Any ideas? 有任何想法吗?

如果您的应用程序未链接使用控制台子系统,则必须自己进行连接

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM