Calling C# dll from C++

后端 未结 1 1802
执笔经年
执笔经年 2021-01-27 01:47

I have a native C++ DLL, and I want to import a C# DLL and use some of its functions (for example connecting to a database).

Now I have read that you can turn the DLL in

相关标签:
1条回答
  • 2021-01-27 02:09

    The best way in my opinion is to crate a C++/CLI lib that you can use to communicate between the layers.

    This 3rd party library will be compiled with /clr enabled.

    Then you can use the header definitions to the proper c++ function wrappers to call the C# functions.

    C++/CLI can help you manage the call just the way you want it, and let you design the type casts the way you want them.

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