473,412 Members | 5,714 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,412 software developers and data experts.

Managed C++ to C# Conversion

I have some code that was written in managed C++ using VS 2005. I want to
convert that code into C#. Is there a tool available to do this?

Thanks in advance.
--

Shailen Sukul
Architect
(BSc MCTS, MCSD.Net MCSD MCAD)
Ashlen Consulting Service P/L
(http://www.ashlen.net.au)
Dec 20 '06 #1
5 7186
"Shailen Sukul" <sh***@ashlen.net.auwrote in message
news:12**********************************@microsof t.com...
>I have some code that was written in managed C++ using VS 2005. I want to
convert that code into C#. Is there a tool available to do this?
It is not guaranteed that such a conversion is possible.

Unlike the case with the other .Net languages of MS, when using C++/CLI or
Managed C++ it is possible to mix native and managed code in the same
application or even the same module.

That's not possible with C#, say.

If the person who chose managed C++ was being rational when he made the
decision that flexibility very well may have been the deciding factor which
means you may be looking at more than simple syntax conversion.

Regards,
Will
Dec 20 '06 #2
"David Anton" <Da********@discussions.microsoft.comwrote in message
news:2C**********************************@microsof t.com...
There is no utility that converts C++/CLI to C#. We make a converter for
the
opposite direction, but in general it is not feasible to make a converter
which converts from a complex language (C++) to a simple language (C#).
This
is why you don't see any (good) converters available which convert from
C++
to any other language.
Actually, several of the best C++ compilers do convert to other languages,
either assembly or C, for which an optimizing compiler is already written.
--
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: C#/VB to C++ converter
Instant Python: VB to Python converter
"Shailen Sukul" wrote:
>I have some code that was written in managed C++ using VS 2005. I want to
convert that code into C#. Is there a tool available to do this?

Thanks in advance.
--

Shailen Sukul
Architect
(BSc MCTS, MCSD.Net MCSD MCAD)
Ashlen Consulting Service P/L
(http://www.ashlen.net.au)

Dec 20 '06 #3

"Shailen Sukul" <sh***@ashlen.net.auwrote in message
news:D7**********************************@microsof t.com...
Thanks for reply.
Say, for arguments sake, that the C++ does not use unmanaged code. Is
there
a utility that will allow me to do a straight code conversion to C# from
C++
Managed code ?
If it was compiled as managed code (unlikely because the MC++ compiler
didn't let you control that), you can just decompile the MSIL with
Reflector.

If it's C++/CLI, then compile with /clr:pure and run Reflector on the
result. With MC++ not even that can save you, because I don't think you can
specify both /clr:pure and /clr:oldStyle at the same time.
--
Thanks.

Shailen Sukul
Architect
(BSc MCTS, MCSD.Net MCSD MCAD)
Ashlen Consulting Service P/L
(http://www.ashlen.net.au)
"William DePalo [MVP VC++]" wrote:
>"Shailen Sukul" <sh***@ashlen.net.auwrote in message
news:12**********************************@microso ft.com...
>I have some code that was written in managed C++ using VS 2005. I want
to
convert that code into C#. Is there a tool available to do this?

It is not guaranteed that such a conversion is possible.

Unlike the case with the other .Net languages of MS, when using C++/CLI
or
Managed C++ it is possible to mix native and managed code in the same
application or even the same module.

That's not possible with C#, say.

If the person who chose managed C++ was being rational when he made the
decision that flexibility very well may have been the deciding factor
which
means you may be looking at more than simple syntax conversion.

Regards,
Will

Dec 20 '06 #4
Right - but they do not convert to simple high-level languages such as C#.
Obviously, a 'conversion' to assembly is done (or to C), but that's a
completely different thing than converting to C# or VB, for instance. Just
try converting a rat's nest of C++ macros and includes to C#.
--
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: C#/VB to C++ converter
Instant Python: VB to Python converter
"Ben Voigt" wrote:
"David Anton" <Da********@discussions.microsoft.comwrote in message
news:2C**********************************@microsof t.com...
There is no utility that converts C++/CLI to C#. We make a converter for
the
opposite direction, but in general it is not feasible to make a converter
which converts from a complex language (C++) to a simple language (C#).
This
is why you don't see any (good) converters available which convert from
C++
to any other language.

Actually, several of the best C++ compilers do convert to other languages,
either assembly or C, for which an optimizing compiler is already written.
--
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: C#/VB to C++ converter
Instant Python: VB to Python converter
"Shailen Sukul" wrote:
I have some code that was written in managed C++ using VS 2005. I want to
convert that code into C#. Is there a tool available to do this?

Thanks in advance.
--

Shailen Sukul
Architect
(BSc MCTS, MCSD.Net MCSD MCAD)
Ashlen Consulting Service P/L
(http://www.ashlen.net.au)


Dec 21 '06 #5
"David Anton" <Da********@discussions.microsoft.comwrote in message
news:3C**********************************@microsof t.com...
Right - but they do not convert to simple high-level languages such as C#.
Obviously, a 'conversion' to assembly is done (or to C), but that's a
completely different thing than converting to C# or VB, for instance.
Just
try converting a rat's nest of C++ macros and includes to C#.
Am I allowed to use goto? And put everything in the main function? You're
right of course that the output isn't very human-friendly (not even
hacker-friendly), but the target language really only affects performance
and ABI.

As far as "rat's nest of macros and includes" are concerned, there's the
C/C++ preprocessor that does source->source comversion that is still quite
human friendly.
--
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: C#/VB to C++ converter
Instant Python: VB to Python converter
"Ben Voigt" wrote:
>"David Anton" <Da********@discussions.microsoft.comwrote in message
news:2C**********************************@microso ft.com...
There is no utility that converts C++/CLI to C#. We make a converter
for
the
opposite direction, but in general it is not feasible to make a
converter
which converts from a complex language (C++) to a simple language (C#).
This
is why you don't see any (good) converters available which convert from
C++
to any other language.

Actually, several of the best C++ compilers do convert to other
languages,
either assembly or C, for which an optimizing compiler is already
written.
--
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: C#/VB to C++ converter
Instant Python: VB to Python converter
"Shailen Sukul" wrote:

I have some code that was written in managed C++ using VS 2005. I want
to
convert that code into C#. Is there a tool available to do this?

Thanks in advance.
--

Shailen Sukul
Architect
(BSc MCTS, MCSD.Net MCSD MCAD)
Ashlen Consulting Service P/L
(http://www.ashlen.net.au)



Dec 21 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Dick Swager | last post by:
The following code is from a solution with a C++ project and a C# project. The C++ project creates a managed array and the C# project tries to use it. But I am having a 'System.ValueType' to...
3
by: Alper Akcayoz | last post by:
Hello Esteemed Developers I face problems using some managed codes in unmanaged ones and vice versa. For exampla I frequently took the following error message. That is C2440: 'type cast' : cannot...
3
by: zhphust | last post by:
I want to convert a object of a managed class to a unmanaged structure that has the same member with that managed class. Can anybody tell me how i can do it? Thanks in advance. -- zhphust...
3
by: Peter Oliphant | last post by:
In the 2002 version of VS C++.NET if I wanted to create a new Managed C++ application I would got to "New Projects", then select "C++ Projects," then "Managed C++ Application". I recently...
12
by: RadekP | last post by:
Question : Is there any 100% managed-code API component on the market that allows DOC/HTML -> PDF conversions similar to the activePDF wrapper (http://www.activepdf.com) ? I would like to stress...
9
by: Herby | last post by:
Is possible to have a managed method within a Native(un-managed) class within a \clr project? E.g. class myClass { public: #pragma managed void myMethod(void);
4
by: devmentee | last post by:
I want to write a managed wrapper( kind of proxy) which will call into unmanaged C++ code. I've got a general idea and have read some articles on how to do it. But I cannot find any information on...
7
by: Robin Imrie | last post by:
Hi, I have some code like this.... MyObject ^o = gcnew MyObject(); My2ndObject ^obj2 = o->GetObject(); if( obj2 != NULL ) {
16
by: pkoniusz | last post by:
Hello everybody, Been just thinking how actually one could convert the following unmanaged code to the managed C++: struct JustAnExample { char value1; int value2; // etc ....
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.