문제

I have an old application that is built using MFC, and makes use of WinAPI function calls for Ethernet communication. It uses API calls for multithreading, synchronization (mutexes, etc), ReadFile to read overlapped IO, etc.

Is it possible to create a new WPF .Net application and import the existing Ethernet communication source code wirtten using WinAPI, without having to rewrite the code using .Net?

도움이 되었습니까?

해결책

You have a variety of options:

  1. Expose the native code using COM.
  2. Compile the native code into a C++/CLI mixed mode assembly. Wrap the native code in a managed ref class which can be consumed by the C# code as any other managed assembly would be.
  3. Compile the native code into a native DLL. Expose the functionality through exported functions. Use p/invoke to call the native functions.
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top