Question

I have a couple c++ utilities that I would like to port over to dot net. I was wondering if there are tools for porting a c++ application to c#?

I imagine that any automated tool would make a mess of any code, so perhaps, I should also be asking if this is a good idea or not?

Was it helpful?

Solution

The better question is why would you ever just port working code without gaining added value (ie new features)? The effort will almost cetainly be harder and take longer than you expect. Better, use the many interop capabilities of .Net to call your c++ code from C#. Focus on adding new features in C#, but don't waste your time porting working code.

OTHER TIPS

  1. Keyboard.
  2. Mouse.
  3. Monitor.
  4. Coffee.
  5. Regular expression search and replace.

Sure, it is a lively market. Going from C++ to C# gives you something that might compile cleanly. Making it actually work takes a line-by-line, "oh gawd I'll shoot myself tomorow" effort. YMMV.

This should have been a comment. But I do not have enough credentials to post a comment. This is not exactly relevant to your question. I thought it will be useful for you.

C++ -> C#: What You Need to Know to Move from C++ to C#

My company, Semantic Designs has a tool that convert from C++ to C#. It handles the conversion core language constructs from C++ (data/class declarations, executable statements) to C#. The translation tool is based on the DMS Software Reengineering Toolkit.

It needs customization to handle translating exotic constructs (COM calls, your custom APIs, ...) to C#. Any tool you might find will need such customization; no off-the-shelf tool can practically address your complete set of specific circumstances.

How about the C++/CLI compiler, which produces .NET assemblies from C++ code. Eventually you'll want to rework the entry points to accept .NET types (e.g. System::String instead of the classic char *), but you'll get to .NET a lot quicker by not using C#. There are also automated conversions between C++/CLI and C#, but only after the C++ code is .NETified (the aforementioned conversion to System::String, generic<typename T> System::Collections::Generic::List, etc.)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top