Friday, May 30, 2008

Before Starting C++/CLI ?

Before starting C++/CLI we should have some basic knowledge .

The .NET Framework

It’s important for you to have a basic understanding of the .NET Framework.

  • .NET Framework: The .NET Framework is Microsoft’s implementation of the Common Language Infrastructure (CLI), which itself is an open specification that has been standardized by the ECMA (an international standards body). The .NET Framework consists of the Common Language Runtime (CLR) and the Base Class Library (BCL).
  • CLR: The Common Language Runtime is the core of the .NET Framework and implements the fundamental aspects of the CLI such as the Virtual Execution System (VES), the Garbage Collector, and the Just in Time (JIT) compiler.
  • BCL: The Base Class Library is an extensive set of .NET classes that is used by any .NET language (such as C#, VB.NET, C++/CLI, and so on).
  • VES: The Virtual Execution System is the engine responsible for executing managed code, including the invocation of the Garbage Collector as well as the JIT compiler.
  • Garbage Collector: Memory management is automatically done in the .NET Framework. The CLR includes a Garbage Collector that frees resources when they’re no longer needed, so the developer doesn’t need to worry about that.
  • JIT compiler: .NET compilers (C#, VB.NET, C++/CLI, and so on) compile source code into an intermediate language called Microsoft Intermediate Language (MSIL). At runtime, the CLR uses the JIT compiler to compile this MSIL into the native code for the underlying operating system before executing it.
  • CTS: The Common Type System (CTS) is a set of rules that specifies how the CLR can define, use, create, and manage types.
  • CLS: The Common Language Specification (CLS) is a subset of the CTS that all languages must implement if they’re to be considered CLS-compliant. CLScompliant languages can interop with each other as long as they don’t use any non-CLS-compliant features present in their specific compiler version.

 

Why C++/CLI

 

Write powerful managed applications
When Brandon Bray from the Visual C++ Compiler team said that C++/CLI would be the lowest-level language outside of MSIL, he meant what he said! C++/ CLI supports more MSIL features than any other CLI language; it is to MSIL what C used to be to Assembly Language in the old days. C++/CLI is currently the only CLI language that supports stack semantics and deterministic destruction, mixed types, managed templates, and STL.NET (a managed implementation of the Standard Template Library).

Most powerful language for interop
Although other languages like C# and VB.NET have interop features, C++/CLI offers the most powerful and convenient interop functionality of any CLI language. C++/CLI understands managed types as well as native types; consequently, you often end up using whatever library you want (whether it’s a native DLL or a managed assembly) without having to worry about managed/native type conversions. Using a native library from C++/CLI is as simple as #include-ing the required header files, linking with the right lib files, and making your API or class calls as you would normally do. Compare that with C# or VB.NET, where you’re forced to copy and paste numerous P/Invoke declarations before you can access native code. In short, for any sort of interop scenario, C++/CLI should be an automatic language choice. One popular use of interop is to access new managed frameworks such as Windows Forms from existing native applications.

 

 

Launching soon : SenApi.com

 

 

No comments: