我正在移植一个 Windows C# 应用程序以在 Linux 上运行。该应用程序使用对 Windows 系统库的 PInvoke 调用——这在 Linux 上不可用。
这是我在移植时遇到问题的代码部分的片段:
namespace MyApp
{
static class Program
{
[DllImport("kernel32.dll")]
static extern bool AttachConsole(int dwProcessId);
private const int ATTACH_PARENT_PROCESS = -1;
[DllImport("user32.dll")]
static extern bool ShowWindow(IntPtr HWND, int CMDSHOW);
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
AttachConsole(ATTACH_PARENT_PROCESS);
// ...
}
}
}
单声道框架中是否有类似的功能?如果不是,我如何在 Mono 上实现类似的行为?我在 Ubuntu 10.0.4 LTS 上运行