Use C++ dll from C#

2019-08-10 09:54发布

I have a C# GUI, and a dll I compiled in matlab for C++. I would like to call from my C# code to the dll functions. I tried first to convert the C# code to CLI, but then saw it is not recommended. Can I create one solution with 2 projects - one the C# GUI and one - wrap the c++ dll with C++ code and call it from the C# ?

Any reference will be appreciated.

Thanks

1条回答
劳资没心,怎么记你
2楼-- · 2019-08-10 10:18

You can use C++ dll's in C# by using [DllImport] attribute, it is described in this MSDN thread.

查看更多
登录 后发表回答