Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Converting a C++ program into C#

Tags:

c++

c#

I'm working on a project where I'm converting C++ code to C# manually. I have working knowledge of C# but I've never used C++ before.

What I need to know is how to deal with the header files, since C# does't have anything like that. Say I have buffer.h and buffer.cpp, would I just convert them both and include them in the same buffer.cs file?

Is the C++ header file in any way related to an Ada spec file?

like image 991
David DeMar Avatar asked May 04 '12 13:05

David DeMar


People also ask

Can I convert C++ to C?

It is possible to implement all of the features of ISO Standard C++ by translation to C, and except for exception handling, it typically results in object code with efficiency comparable to that of the code generated by a conventional C++ compiler.

What is conversion in C programming?

In C programming, we can convert the value of one data type ( int, float , double , etc.) to another. This process is known as type conversion.

Which converts C program to machine language?

A compiler is a program that convert a source program written in high-level programming language such as C,Java in to machine language.


1 Answers

The distinction between includes ".h files" and source ".cpp files" is only one of convention. The convention is that declaration (functions, classes, etc) are in .h files which are #included in implementation (definition), or .cpp files. For most cases you're fine in collapsing X.h and X.cpp to a single X.cs file.

That said, you still need to take a look at what is going on in each file. A basic understanding of C++ would go a long way here, and something I strongly recommend you acquire before you get too far into your translation.

like image 130
luke Avatar answered Sep 28 '22 17:09

luke