Add C++/CLI support in your legacy code

Add C++/CLI support in your legacy code

Just now I'm maintaining an old piece of code, written in C++. And now i  just want to search out some special strings following special pattern, and it seems that there is no good way that the tradition c++ way. So since now the .net is growing almost 7 years old and the c++/cli is coming mature, i decide to take advantage of the .net powerful functionality.

Steps are simple, not very complicated.
Here is the steps.
1. Add the header file (.h).
2. Add the body file (.cpp). Include the header file in the body file.
3. Pop-up the Property page for the body file. Property->C/C++->General-> Compile with common language support : common language runtime support
4. If your project is vc++ and uses the precompiled header, go to Property->C/C++-> Precompiled Headers->Create/Use Precompiled Header : Not using precompiled header.
5. You also needs to set Property->C/C++-> Enable C++ Exception : Yes with SEH Exceptions(/EHa)

ok, now go to rebuild your project and it will works!

Enjoy the power of the .NET!

你可能感兴趣的:(Add C++/CLI support in your legacy code)