473,473 Members | 1,823 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Bringing C++ code over to a C# project

Rob
Well I'm sure most of you guys that converted from C++ to C# had this
problem: how can I bring my C++ code over? (in my case it would be much to
difficult to rewrite it) I need to bring over a few classes and structs.

Being a complete beginner to C#, almost everything I read on the subject
looks incredibly confusing, so I have come to you guys, the experts. What do
you think would be the easiest way to migrate my C++ code into a brand new C#
project?

Thanks in advance.
May 10 '06 #1
3 1201
Rob,

When migrating from C++, you have little choice but to re-write it. The
only other options you have are providing a managed wrapper to the C++ code
you have, or exposing it as a COM object, and then using it in C#.

Do you expose your code through functions, or COM objects already? If
you do, then you don't really have to do much. However, if you have C++
classes only, or nothing that is exportable, then you are going to have a
difficult time of it, based on the classes and their relationships with each
other (pointers, etc, etc).

Can you give more information about the project?

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Rob" <Ro*@discussions.microsoft.com> wrote in message
news:9E**********************************@microsof t.com...
Well I'm sure most of you guys that converted from C++ to C# had this
problem: how can I bring my C++ code over? (in my case it would be much to
difficult to rewrite it) I need to bring over a few classes and structs.

Being a complete beginner to C#, almost everything I read on the subject
looks incredibly confusing, so I have come to you guys, the experts. What
do
you think would be the easiest way to migrate my C++ code into a brand new
C#
project?

Thanks in advance.

May 10 '06 #2

"Rob" <Ro*@discussions.microsoft.com> wrote in message
news:9E**********************************@microsof t.com...
Well I'm sure most of you guys that converted from C++ to C# had this
problem: how can I bring my C++ code over? (in my case it would be much to
difficult to rewrite it) I need to bring over a few classes and structs.

Being a complete beginner to C#, almost everything I read on the subject
looks incredibly confusing, so I have come to you guys, the experts. What
do
you think would be the easiest way to migrate my C++ code into a brand new
C#
project?

Thanks in advance.


Wow, a developer coming from C++ to C# gets confused?!? I can see that it
is more confusing to go to C++, but not the other way around. In any case,
you will probably need to rewrite most (if not all) of the C++ code into C#.

HTH,
Mythran

May 10 '06 #3
Rob
Hmmz that's what I was afraid of. It does have quite a bit of pointers, and
certain things that I would very likely have a lot of trouble converting to
C#.

Do you know of any good tutorials for importing C++ DLLs into C#?

"Nicholas Paldino [.NET/C# MVP]" wrote:
Rob,

When migrating from C++, you have little choice but to re-write it. The
only other options you have are providing a managed wrapper to the C++ code
you have, or exposing it as a COM object, and then using it in C#.

Do you expose your code through functions, or COM objects already? If
you do, then you don't really have to do much. However, if you have C++
classes only, or nothing that is exportable, then you are going to have a
difficult time of it, based on the classes and their relationships with each
other (pointers, etc, etc).

Can you give more information about the project?

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Rob" <Ro*@discussions.microsoft.com> wrote in message
news:9E**********************************@microsof t.com...
Well I'm sure most of you guys that converted from C++ to C# had this
problem: how can I bring my C++ code over? (in my case it would be much to
difficult to rewrite it) I need to bring over a few classes and structs.

Being a complete beginner to C#, almost everything I read on the subject
looks incredibly confusing, so I have come to you guys, the experts. What
do
you think would be the easiest way to migrate my C++ code into a brand new
C#
project?

Thanks in advance.


May 10 '06 #4

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

Similar topics

16
by: Fox | last post by:
I merged and modified these script which work perfectly fine as long as I use server.execute to access the VBS part (which is itself in another ASP file). When these I use a session variable to...
1
by: dalei | last post by:
I like to make foreign letters to appear in the textarea. For instance, when typing the letter 'a' on the keyboard, the Japanese letter &#+12449; would appear in the textarea. Could somebody...
13
by: Martin Dennett | last post by:
Hi I'm new to this group so go easy on me! I currently use a database that has had one constant niggle for a while and I was wondering if anybody can help sort it out. From an opening screen...
2
by: Mike Turco | last post by:
I like using the expression builder for a lot of different things but it isn't always available when I want to use it, for example in the code window, or in all of the control properties. I am...
1
by: Kevin Carter | last post by:
Hi there...hoping somebody can help me out because I am almost ready to pull out my hair. My problem is as follows: In a method in my main form (non MDI app), I instantiate and .Show another...
4
by: Kevin Carter | last post by:
Hi there...hoping somebody can help me out because I am almost ready to pull out my hair. My problem is as follows: In a method in my main form (non MDI app), I instantiate and .Show another...
3
by: Richard L Rosenheim | last post by:
I have the application's form (MainForm) along with a 2nd form (Form2). If the user minimizes MainForm, I also minimize Form2. And when the user restores the application, I also restore Form2. ...
5
by: Mary Anne | last post by:
One of my clients is using Acc97 runtime to run an Access application. The application has a Custom Toolbar, but she excluded the toolbar from the application. Now, I cannot display the toolbar...
0
by: jjh | last post by:
So my code is below. I have a problem... I am trying to bring in a text file that is like this: Principles of Biochemistry Biology Chemistry $ Introductory Organic Chemistry Chemistry $ ...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...
1
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.