Managed C++. Objectives Overview to Visual C++.NET Concepts and architecture Developing with Managed Extensions for C++ Use cases Managed C++, Visual.

Slides:



Advertisements
Similar presentations
Introduction to .NET Framework
Advertisements

.NET Framework Overview
Tahir Nawaz Introduction to.NET Framework. .NET – What Is It? Software platform Language neutral In other words:.NET is not a language (Runtime and a.
Camel Crossings: Perl & the Microsoft.NET Framework Brad Merrill, Microsoft Jan Dubois, ActiveState Eric Promislow, ActiveState.
History of.Net Introduced by Microsoft Earlier technology was VC++ and VB VC++ comes with so many library and VB was so easy to use and not flexible to.
.NET Framework Overview Pingping Ma Nov 16 th, 2006.
Overview of the.NET Framework. What is the.NET Framework A new computing platform designed to simplify application development A consistent object-oriented.
C#.NET C# language. C# A modern, general-purpose object-oriented language Part of the.NET family of languages ECMA standard Based on C and C++
C#/.NET Jacob Lewallen. C# vs.NET.NET is a platform. Many languages compile to.NET: –VB.NET –Python.NET –Managed C++ –C#
Introducing the Common Language Runtime for.NET. The Common Language Runtime The Common Language Runtime (CLR) The Common Language Runtime (CLR) –Execution.
ASP.NET Programming with C# and SQL Server First Edition
Introducing the Common Language Runtime. The Common Language Runtime The Common Language Runtime (CLR) The Common Language Runtime (CLR) –Execution engine.
1 An Introduction to Visual Basic Objectives Explain the history of programming languages Define the terminology used in object-oriented programming.
Platforms and tools for Web Services and Mobile Applications Introduction to C# Bent Thomsen Aalborg University 3rd and 4th of June 2004.
Copyright © 2002 OSI Software, Inc. All rights reserved..NET Experiences Chris Manhard and David Hearn OSI Software, Inc.
Rajeswari Indupuri Introduction to.NET Framework.
Chapter 12 Microsoft Assemblies. Process Phases Discussed in This Chapter Requirements Analysis Design Implementation ArchitectureFramework Detailed Design.
A Free sample background from © 2001 By Default!Slide 1.NET Overview BY: Pinkesh Desai.
Architecture Of ASP.NET. What is ASP?  Server-side scripting technology.  Files containing HTML and scripting code.  Access via HTTP requests.  Scripting.
Lecture Roger Sutton CO530 Automation Tools 5: Class Libraries and Assemblies 1.
1 Introduction to.NET Framework. 2.NETFramework Internet COM+ Orchestration Orchestration Windows.NET Enterprise ServersBuildingBlockServices Visual Studio.NET.
Introduction to .Net Framework
1 8/29/05CS360 Windows Programming Professor Shereen Khoja.
© 2008 Dr. Paul Walcott – The University of the West Indies: Cave Hill CampusDr. Paul Walcott COMP6325 Advanced Web Technologies Dr. Paul Walcott The University.
.NET Overview. 2 Objectives Introduce.NET –overview –languages –libraries –development and execution model Examine simple C# program.
Session 1 - Introduction and Data Access Layer
CIS NET Applications1 Chapter 2 –.NET Component- Oriented Programming Essentials.
.NET Framework & C#.
Introduction to.NET Framework. .NET – What Is It? Software platform Language neutral In other words:.NET is not a language (Runtime and a library for.
Microsoft Visual Basic 2005: Reloaded Second Edition
Appendix D: Microsoft.NET Framework Overview. Overview.NET Framework Architecture.NET Namespaces.
 Internet providing backbone for applications  Use of several web sites and devices to provide one complete solution  Software as services  Quick software.
Introduction to .NET Framework
Lecture Set 1 Part B: Understanding Visual Studio and.NET – Structure and Terminology 1/16/ :04 PM.
Lesley Bross, August 29, 2010 ArcGIS 10 add-in glossary.
Introduction .NET Framework
C# Overview and Features. Content I.History of C# II.Architecture III.How to install IV.Features V.Code Sample VI.Microsoft.NET Platform VII.Why use C#
C# Programming Fundamentals of Object-Oriented Programming Fundamentals of Object-Oriented Programming Introducing Microsoft.NET Introducing Microsoft.NET.
CS795/895: Introduction. Topics Distributed Systems –Availability –Performance –Web Services Security –Authentication –Authorization –Confidentiality.
.NET Language Supports. .NET Language Support Operating System Common Language Runtime Base Class Library ADO.NET and XML ASP.NET Web Forms Web Services.
.NET Framework Danish Sami UG Lead.NetFoundry
Algorithm Programming Bar-Ilan University תשס"ח by Moshe Fresko.
Languages and IDE (Integrated Development Environment)
tom perkins1 XML Web Services -.NET FRAMEWORK – Part 1 CHAPTER 1.1 – 1.3.
Module 1: Getting Started. Introduction to.NET and the.NET Framework Exploring Visual Studio.NET Creating a Windows Application Project Overview Use Visual.
Module 3: Using Microsoft.NET- Based Languages. Overview Overview of the.NET-Based Languages Comparison of the.NET-Based Languages.
Fortran 95 for the.NET Framework David Bailey
PRIOR TO WEB SERVICES THE OTHER TECHNOLOGIES ARE:.
.NET Ying Chen Junwei Chen. What is Microsoft.NET. NET is a development platform Incorporated into.NET COM+ component services ASP web development framework.
Microsoft .NET A platform that can be used for building and running windows and web applications such that the software is platform and device-independent.
Managing C++ CHRIS DAHLBERG MID-TIER DEVELOPER SCOTTRADE.
PerlNET: The Camel Talks.NET Jan Dubois The Perl Conference 6 San Diego, July 26 th 2002.
Getting Started with.NET Getting Started with.NET/Lesson 1/Slide 1 of 31 Objectives In this lesson, you will learn to: *Identify the components of the.NET.
DEV 420 Head-Spinning C++ Managed-Native Interoperability Kate Gregory Gregory Consulting.
DEV394.NET Framework: Migrating To Managed Code Adam Nathan QA Lead Richard Lander Program Manager Microsoft Corporation.
INTRODUCTION CHAPTER #1 Visual Basic.NET. VB.Net General features It is an object oriented language  In the past VB had objects but focus was not placed.
July 22, 2001Introduction to.NET1 Introduction to.NET Framework Gholamali Semsarzadeh July 2001.
Text Introduction to.NET Framework. CONFIDENTIAL Agenda .NET Training – Purpose  What is.NET?  Why.NET?  Advantages  Architecture  Components: CLR,
INTRODUCTION BEGINNING C#. C# AND THE.NET RUNTIME AND LIBRARIES The C# compiler compiles and convert C# programs. NET Common Language Runtime (CLR) executes.
Sung-Dong Kim, Dept. of Computer Engineering, Hansung University Java - Introduction.
Introduction to the Microsoft.NET Framework Chris Wastchak Student Ambassador to Microsoft.
Jim Fawcett CSE775 – Distributed Objects Spring 2009
.Net A brief introduction to
Microsoft .NET 3. Language Innovations Pan Wuming 2017.
.NET and .NET Core 2. .NET Runtimes Pan Wuming 2017.
CS360 Windows Programming
Introduction to C# AKEEL AHMED.
Module 10: Implementing Managed Code in the Database
DOT NET ARCHITECTURE (OR) DOT NET FRAME WORK ARCHITECTURE
Jim Fawcett CSE681 – Software Modeling and Analysis Fall 2006
Presentation transcript:

Managed C++

Objectives Overview to Visual C++.NET Concepts and architecture Developing with Managed Extensions for C++ Use cases Managed C++, Visual Studio.NET and the.NET Framework

Contents Section 1: Overview Section 2: New features in Visual C++.NET Section 3: Managed extensions for C++ Section 4: Writing managed C++ applications Questions

Section 1: Overview Looking back Managed Execution

Looking back Object-oriented programming COM+ Most successful component model in history Only viable commercial component platform Enables cross-organization integration and reuse

Looking back Microsoft Foundation Classes (MFC) C++ class libraries Encapsulation of the Windows API Defacto standard for Windows development Active Template Library (ATL) C++ templates for COM development

What’s wrong with that? COM shows its age DCOM does not function well over the Internet More component based systems, more "DLL Hell" Difficult to implement Not truly language agnostic Makes some assumptions of binary layout "Least-common denominator" type system only Continuously growing API set Inconsistencies in programming model

Managed Execution Common Language Runtime (incl. CTS and CLS) IL & Metadata Class Lib Class Loader Managed native Code Execution Compiler JIT Compiler Source Code

Section 2: New features in VC++.NET Visual C++.NET Compiler options Linker options New Keywords and types Managed Extensions

Visual C++.NET New features Compiler and linker options New preprocessor features Keywords and types Attribute based programming Easy COM programming Event Handling Managed Extensions

Managed classesUnmanaged classes Managed Extensions C++ language extensions Access to the.NET Framework MFC / ATL.NET WIN32 API PInvoke COM Interop

Compiler options New options in all categories Some samples Debugging Code generation Misc /GS – generate security check /RTC – enables runtime check /Wp64 – detects 64bit portability problems /GL – enables complete program optimization /Wall, /w – enables/disables all warnings

/CLR Common Language Runtime (CLR) compilation Creating managed code Application must include Enables Managed Extensions For all functions But not for classes, interfaces, or structs (see __gc) #using using namespace System;

Linker options Samples Unmanaged development Managed Extensions /TSAWARE – create terminal server aware application /LTCG – link-time code generation, combination of /GL and /c, enables complete programming optimization /ASSEMBLYMODULE – add an IL module to an assembly /ASSEMBLYRESOURCE – link to a managed resource /NOASSEMBLY – create an IL module

Keywords and types New types samples wchar_t - is now a native data type __m64, __m128 - Microsoft specific data types for use with MMX and SSE Keywords (Managed Extensions) __delegate - declares a reference to a method __property - declares a property for a managed class __gc - declares a garbage collected class __event, __abstract, __interface, __value,...

Section 3: Managed Extensions Language interoperability Managed code Garbage Collection Exception Handling

Language interoperability Managed class types __gc Garbage collected classes __value Value classes __gc __interface Managed interface classes Managed Arrays __gc keyword String literals One string for all! Int MyIntArray __gc[] = new int __gc[100];

Interoperability Delegates Object-oriented function pointer __delegate keyword Single- and multicast delegate Properties of managed objects Pseudo data member __property keyword Scalar and indexed properties

Garbage Collection Automatic memory management Memory is allocated and freed by the CLR Managed Heap Managed data Access through managed code Declare objects as managed/unmanaged __gc and __nogc keywords #pragma managed/unmanaged

GC – in depth Roots Each application has a list of references Used objects in managed heap Objects which are set to null Problems with the collection point of time Sometimes resources have to be freed immediately

GC and your destructor Destructor ? Managed objects never have destructors Finalization !... is called automatically Close and Dispose Control over clean-up

__gc sample #using using namespace System; __gc class GcInt { public: int ReturnInt() { return 5; } }; int callGcInt() { GcInt* pgci; pgci = new GcInt; return pgci->ReturnInt(); } void main() { Console::WriteLine( callGcInt() ); } No delete !

Handling exceptions Structured (SEH) and C++ exception handling Throwing exceptions Pointer to managed objects Try/catch block Like unmanaged code __finally keyword Clean up resources Always (!) executed

Section 4: Applications w/ VC++.NET Use cases Migration MFC, ATL, and.NET Managed vs. unmanaged

Operational areas Interaction Unmanaged C++ and.NET code Mixing Managed and unmanaged code within one executable Migration from unmanaged C++ code to the.NET Framework

Interaction I Accessing.NET Framework from unmanaged code.NET Framework Unmanaged world Managed Extensions CCW

The Type Library Exporter Command line tool Takes CLR assembly to generate type library Input:.NET assembly Output:.tlb TlbExp assembly [/out:file] [/silent] [/verbose] [/nologo]

Interaction II Accessing a C++ object from the.NET Framework.NET Framework Unmanaged world RCW

Command line tool Convert COM type definitions into.NET metadata Input:.tlb,.dll,.odl,.ocx, or.exe Output: metadata DLL The Type Library Importer TlbImp tlblib [/out:file] [/publickey:file] [keyfile:file] [keycontainer:file] [/silent] [/verbose] [/nologo] [/unsafe]

Mixing Managed and unmanaged code in one executable Seamless interoperation Fine grained control Problems with Inheritance Pointer

Migration Two ways Directly: step-by-step migration Mixing managed and unmanaged code Indirectly: build a wrapper (see interaction) Make your code callable from the.NET Framework

Managed vs. unmanaged Code Unmanaged compiler generates executable x86 code Managed 2-step-compilation (IL and JIT) Data Unmanaged Layout by compiler, no garbage collection Managed Layout by CLR, garbage collection

ATL, MFC and.NET MFC MFC is not legacy Rich client development WinForms covers MFC GUI ATL New features, like Security classes Simple object creation ATL Server Web Applications and Web Services

Summary First insight: Visual C++.NET Managed Code Managed Extensions for C++ Migration and interoperation of managed and unmanaged code Perspectives: Not all code will be managed MFC and ATL are not dead!

Questions