Click here to Skip to main content
12,954,153 members (50,870 online)
Rate this:
 
Please Sign up or sign in to vote.
See more:
Is there a tool can convert C++ code to C# code.Thank you.
Posted 8-Aug-12 15:29pm
pucx1.3K
Updated 13-Apr-17 4:40am
Comments
pasztorpisti 9-Aug-12 2:42am
   
I think its better to convert your code manuall because I don't believe that such an automated translater can do good job. The tools these languages provide are quite different and they have other conceptual differences (like object lifetime). How does this compiler handle different smart pointers - just to pick something I suspect to be hard for the translator. I think the generated C# code for a non-trivial C++ code can only be garbage compared to one that has been redesigned and rewritten by a human. The problem is that often there is no one-on-one mapping because of the conceptual differences - in such cases a new design is needed and the translator won't be thinking istead of you. :-)
Volynsky Alex 9-Aug-12 11:25am
   
http://forums.asp.net/t/1213219.aspx/1
http://social.msdn.microsoft.com/forums/en-US/csharplanguage/thread/cbcb354b-cfce-4084-a9de-99d6c6779f7d/
http://social.msdn.microsoft.com/Forums/en-US/vclanguage/thread/b33a2d46-c2a0-45ea-a29d-2c16ac669c52/
http://www.tangiblesoftwaresolutions.com/Product_Details/CPlusPlus_to_CSharp_Converter_Details.html
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

To be honest with you, I have yet to find an automated tool that works better than the human mind. This is probably a task you want to do yourself, why? ..because you can rationalize what makes sense and what doesn't, further more, you can work as the tester in the loop simultaneously by making sure all your translations do what they're supposed to.

That's just my opinion, but I don't even like the Visual Studio wizards. They break too easily and they teach new developers to not have to learn what's really going on behind the scenes.
  Permalink  
Comments
pucx 8-Aug-12 23:56pm
   
I have many codes that is written by C++,I want to convert these to C#.If I convert by hand,a lot of time will waste.Thank you.
Albert Holguin 9-Aug-12 1:16am
   
Why do you want to convert it anyway? Why not use it and just interface it one way or another?
pasztorpisti 9-Aug-12 5:02am
   
Good point!
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

The best tool is an automated engine driven by precise language parsing, semantics, and rules. In the case of the CLR, you can keep your existing code and add any new features using C# rather than C++.
http://www.dapfor.com/en/net-suite/net-grid/tutorial/data-sorting[^]
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 8

You can use C++ code in C# with some easy steps by build an dll around the C++ code. But it depends on the code, for instance UI code isnt transferable.

Take a look at my article.
  Permalink  
Comments
0x01AA 13-Apr-17 10:42am
   
Little bit late. I hope OP soved it in between :)
BTW: No vote from my side.

[Edit]
A 5 vote from my side to eliminate the 1.
NotPolitcallyCorrect 13-Apr-17 10:43am
   
Was resurrected due to a spammer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month
OriginalGriff 6,464
CHill60 3,490
Maciej Los 3,123
ppolymorphe 2,020
Jochen Arndt 1,975


Advertise | Privacy | Mobile
Web02 | 2.8.170525.1 | Last Updated 13 Apr 2017
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100