C# library to native C++ application

前端 未结 3 1072
说谎
说谎 2021-01-24 02:00

I know I can use dll import + wrapping (managed) to use C++ libraries in C# applications (question link>>) but what\'s opposite? How can I use C# library in my C++ application?

相关标签:
3条回答
  • 2021-01-24 02:38

    CoreRT allows to compile native libraries for windows, linux and osx x64 platform this avoid to you use an C++ compatible layer. CoreRT uses NetCore, and NetCore doesn't support C++/CLI.

    https://dev.to/encrypt0r/writing-native-libraries-in-c-3kl

    0 讨论(0)
  • 2021-01-24 02:55

    You will have to take care to expose your interface from the C# library to a C++-compatible layer.

    Out of the top of my head, you could do two things:

    • Create a C API on top of your C# library (best way would be to add a C++/CLI layer to your library).

    • Create a COM interface to your C# library and use the library through COM objects.

    0 讨论(0)
  • 2021-01-24 02:57

    No CLI?

    You can do it using Reverse P/Invoke

    See http://tigerang.blogspot.co.il/2008/09/reverse-pinvoke.html.

    0 讨论(0)
提交回复
热议问题