Click here to Skip to main content
15,672,334 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
As the title above,I Need a free and lightweight tool to transform simple C# code to C++ code. Any suggestion?
[no name] 18-Sep-12 9:22am    
I would suggest that you just translate it yourself.
fjdiewornncalwe 18-Sep-12 9:26am    
I agree with Wes. any conversion of code form C# into C++ would be pretty intensive and I would be very, very surprised if there were a tool that would effectively automate this process.
Joan M 19-Sep-12 3:06am    
You should do it by yourself.

I doubt you are going to find such a product.
First of all I doubt the tool would really work (however they[^] claim it works, you may try the demo).
Then, I suppose, it won't be not lightweight nor free.
Share this answer
Sergey Alexandrovich Kryukov 18-Sep-12 9:59am    
I agree. The whole idea of such translation does not make strict sense because there are no well-defined correspondence between the platforms. Whatever exists could work or be somewhat useful, but nothing can convince me it can always give correct results, just because what is "correct"? -- it depends case to case. My 5.
CPallini 18-Sep-12 15:45pm    
Thank you.
I don't think such a tool exists, but if I needed to do this I would post it as a job on Someone in a third-world country with a university degree would be thrilled to do it for one or two dollars an hour.
Share this answer
ANTLR C# grammar[^]

This project will generate a C# 4.0 parser using ANTLR v3.2. Then you can add your own logic to do what you want.

Best regards
Espen Harlinn
Share this answer
CPallini 18-Sep-12 9:29am    
Yes just a matter of generating C++ actions from C# semantic...
Espen Harlinn 18-Sep-12 9:34am    
OP mentions that his code is simple, so I hope it does not involve any linq. In addition it's possible to call virtual functions overridden in derived classes from constructors/finalizers in .Net - and as we all know that's not how it works in C++.

Still, automating 80% of the work may be worth a bit of effort.
CPallini 18-Sep-12 15:46pm    
It would be worth the effort if the OP could sell his translator. :-)
Espen Harlinn 18-Sep-12 15:52pm    
I've used the antlr java grammar to imperfectly translate java into C++ implementing just what I needed at the time - this worked well enough even if it was far from a commercial grade tool ...
CPallini 18-Sep-12 16:14pm    

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

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900