Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the main difference between C++ vs C++.NET? [duplicate]

Tags:

c++

visual-c++

Possible Duplicate:
What is the difference between Managed C++ and C++/CLI?
What is CLI/C++ exactly? How does it differ to 'normal' c++?

I am in doubt of distinguishing between C++ and C++.NET.

Is that right C++ is unmanaged code and C++.NET is managed code?

I need to program for a project in C++. For better building the GUI, I would prefer to use C++.NET.

I also have another plain C++ library (unmanaged C++ DLL file), will it be possible to use it as a normal DLL library in the C++.NET project?

like image 326
olidev Avatar asked Jan 03 '12 10:01

olidev


People also ask

What is difference between C C++ and C#?

Key Differences C++ is known as an intermediate-level language that adds object-oriented features to its base C, whereas C# is a high-level language. C++ compiles programs to Machine Codes, and C# compiles programs to Common Language Runtime or CLR.

Is C# and C sharp same?

C# (pronounced "C-sharp") is an object-oriented programming language from Microsoft that aims to combine the computing power of C++ with the programming ease of Visual Basic. C# is based on C++ and contains features similar to those of Java.

Is C# and .NET the same thing?

In summary, C# is a programming language, while . NET is a developer platform. After comparing C# vs . NET, it is clear that both are essential for application development.


2 Answers

Is that right C++ is unmanaged code and C++.NET is managed code.

There's no such thing as "C++.NET". There's C++/CLI, which is basically C++ with Microsoft extensions that allow you to write code targeting the .NET framework. C++/CLI code compiles to CLR bytecode, and runs on a virtual machine just like C#. I'll assume you're actually talking about C++/CLI.

With respect to that, one can say standard C++ is unmanaged and C++/CLI is managed, but that's very much Microsoft terminology. You'll never see the term "unmanaged" used this way when talking about standard C++ unless in comparison with C++/CLI.

Both standard C++ and C++/CLI can be compiled by the same Visual C++ compiler. The former is the default on VC++ compilers, while a compiler switch is needed to make it compile in latter mode.

I need to program for a project in C++. For better building the GUI, I would prefer to use C++.NET.

You can build GUI programs in C++ just as well as C++/CLI. It's just harder because there isn't a standard library in standard C++ for building GUI like the .NET framework has, but there are lots of projects out there like Qt and wxWidgets which provide a C++ GUI framework.

I also have another plain C++ library (unmanaged C++ dll), will it be possible to use it as a normal dll library in the C++.NET project?

Yes. It might take some extra work to deal with the different standard C++ data types and .NET data types, but you can certainly make it work.

like image 183
In silico Avatar answered Oct 17 '22 12:10

In silico


Managed C++ is a now deprecated Microsoft set of deviations from C++, including grammatical and syntactic extensions, keywords and attributes, to bring the C++ syntax and language to the .NET Framework. These extensions allowed C++ code to be targeted to the Common Language Runtime (CLR) in the form of managed code as well as continue to interoperate with native code. Managed C++ was not a complete standalone, or full-fledged programming language.

Managed C++

#using <mscorlib.dll> using namespace System;  int main()  {   Console::WriteLine("Hello, world!");   return 0; } 

Vanilla C++

#include <iostream> using namespace std;  int main() {   cout << "Hello, world!";  return 0; } 
like image 30
Software_Designer Avatar answered Oct 17 '22 13:10

Software_Designer