简体   繁体   中英

Combining C# and C++ in VisualStudio solution

I have quite complex project written in C++ and I'm trying to convert it into C# solution. I thought it would be easiest to left the core in C++, as VC++ class library.

Before I begin, I tried to write simple C++ class that way and use it in C# project. The first problem I get was STL (in core STL, Boost and QT are used): I can't pass C# List as std::list to C++ method.

Is there any easy way to use C++ code with STL, Boos and QT in C# or converting it to C# is easier?

The conversion of C++ into C# is not possible. And there is also no reason to do it. There are some things you can do:

1) Rewrite the GUI in C#

2) Wrap C++ classes with C++/CLI and use them from C#

3) If your application is mostly Gui with not too complex logic behind it, you can use the parts of C++ code in C# in unsafe block.

What you definitely shouldn't do is transfer the c++ code into c# line by line.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM