C++ DLL 和 C# 包装器与 PCIe 板接口

问题描述 投票:0回答:0

我有一个与 PCIe 板通信的 C++ DLL。我还需要将它集成到 C# 程序中,所以我正在为它编写一个包装器。 DLL 是用 C++ 编写的,因为我有开发板生产商提供的测试应用程序,也因为我找不到通过 .NET 连接 PCIe 的方法。 在测试应用程序中,我使用 WaitForSingleObject 从该板接收中断 这是定义的事件

// Create an event handle to pass to the driver
        hEvent =
            CreateEvent(
                NULL,           // Not inheritable to child processes
                TRUE,           // Manual reset?
                FALSE,          // Intial state
                NULL            // Name of object
            );

这就是它的检索方式

// Wait for the event object
        EventStatus =
            WaitForSingleObject(
                (HANDLE)pEvent->hEvent,
                (DWORD)Timeout_ms
            );

如何让监视器连续接收这些中断? (DLL 中的无限循环)? 另外,你能告诉我一个有效的方法来从这个 DLL 触发 C# 中的事件吗? 感谢您的帮助

c# c++ interrupt pci-e
© www.soinside.com 2019 - 2024. All rights reserved.