简体   繁体   English

允许本机 DLL 在 C# 控制台应用程序中输出 stdout/stderr

[英]Allow native DLL to output stdout / stderr in c# console application

I have a native DLL which outputs via stdout / stderr.我有一个通过 stdout/stderr 输出的本机 DLL。

I have a C# console application which calls this DLL and outputs binary data to a parent C# application which started the C# console exe, processing stdout / stderr.我有一个 C# 控制台应用程序,它调用这个 DLL 并将二进制数据输出到启动 C# 控制台 exe 的父 C# 应用程序,处理 stdout/stderr。

Currently when I call the C# exe it works just fine (the DLL hooks up to the stdout of my console application and puts its data in just fine).目前,当我调用 C# exe 时,它​​工作正常(DLL 连接到我的控制台应用程序的标准输出并将其数据放入就好了)。

Is this by design (and shouldn't be broken in future .NET framework versions)?这是设计使然(并且不应在未来的 .NET 框架版本中被破坏)?

Are there limitations on my managed code's deployment with this strategy (full-trust, permission requirements, GAC issues, etc)?使用此策略部署托管代码是否存在限制(完全信任、权限要求、GAC 问题等)?

I can't seem to find any documentation about stdout with a managed exe and an unmanaged dll both putting data in that standard output on MSDN.我似乎找不到任何关于带有托管 exe 和非托管 dll 的 stdout 的文档,这两者都将数据放入 MSDN 的标准输出中。

Thanks,谢谢,

This will work just fine.这将工作得很好。 Be aware that your code will need full trust permissions on the client machine in order to call into a native DLL, however.但是请注意,您的代码需要在客户端计算机上具有完全信任权限才能调用本机 DLL。

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

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