Native Development In Visual C NET Terry Leeper





















![Attribute Implementation [soap_handler] class X { //. . . }; Compiler Linker Component Code Attribute Implementation [soap_handler] class X { //. . . }; Compiler Linker Component Code](https://slidetodoc.com/presentation_image_h2/7eda58fdb2a7deab71b7b667c9bfa74e/image-22.jpg)
![Implementation Overview l Before [ trace(1) ] class CSome. Class { public: void mf() Implementation Overview l Before [ trace(1) ] class CSome. Class { public: void mf()](https://slidetodoc.com/presentation_image_h2/7eda58fdb2a7deab71b7b667c9bfa74e/image-23.jpg)

















- Slides: 40
Native Development In Visual C++. NET Terry Leeper Program Manager Visual C++ Microsoft Corporation
“For Native C++ Developers, Visual C++. NET is VC++ 7. 0”
Agenda l l l Debugger Libraries Compiler
Debugger Features – Functionality l Post mortem debugging of mini-dumps Ø Ø l l Remote attach Detach Ø Ø l Mini-dumps are compressed May have memory dump XP and Server 2002 Through proxy on Win 2 K Can debug multiple programs even if on different machines
Debugger Features – Functionality (2) l l Reload symbols Much better stackwalking Ø l Fixed FPO debug info Symbol Serving Ø Ø Can keep all symbols (PDB files) in one central location Can find these symbols (including OS) regardless of build and/or OS SP
Debugger Features – Edit And Continue l l l Add new types Add/delete non-virtual methods of a type Dynamic DLL importing
Debugger UI Features l Single UI for all debugging Ø Ø Ø Native C++ Managed C++ Other Languages Script SQL
Breakpoints l l Dockable window Set in margin by clicking Can set up in DLL after starting the debug session Can set on a per-thread basis
Command l Win. Dbg-style commands Ø l Expressions Ø Ø Ø l ~$kb – dumps stack, for instance Long Symbols HRESULT wchar_t @clk @err @tib Immediate
Memory l Memory Ø l Multiple windows Unicode support Ø Ø Automatically display correct values Can use in expressions
Registers l New Register Types Ø Ø Ø l MMX SSE, SSE 2 3 DNow! Organized
Modules/Threads l Threads Ø Ø l Modules Ø l Dockable window! Can freeze threads Shows modules loaded up in the process being debugged Shows module Ø Ø Load orders Paths Symbol loads Relocation
Library Features l l ATL MFC CRT STL
New Features in ATL l ATL Server Ø Ø Ø Extends ATL for creating Web Applications and Web Services and is build atop ISAPI ATL ideal of flexibility, performance, and reusability Can use ATL Server for § § § Web apps Web services Web clients Message Queuing Cryptography SMTP Mail
ATL Server Features l l l Stencil processing – breaks out HTML from C++ code Thread pool Caching Ø l l Blob, file, database connection Web Services Many more Ø Ø Session Service Cookies
New Features In ATL l Common MFC classes integrated in Ø l Better Windows 2000 Support Ø Ø l CString, CFile, CTime, CRect, CPoint, CSize Encryption Support Better NT Security Support Performance Monitors SAFEARRAY Many ATL Server features available to ATL and MFC Ø Thread pool, caching, http client, SMTP mail
MFC Top Customer Features Added l Windows 2000 support Ø Ø Ø l Top customer requests Ø Ø Ø l Accessibility Common control/dialog improvements Fusion support - MFC/ATL per app dll CString performance 64 -bit CTime Read/write different image formats Dynamic HTML Dialogs Better integration between MFC & ATL Web Service Support
New Features In STL l l Better conformance to the standard; extensive use of member templates Added common extension files hash_map and hash_set Support of wchar_t as a native type Much, much better documentation Ø Ø Ø Extensive help system Longer variable names Better whitespace use and comments
New Features In CRT l l l l VC CRT now separate from system CRT Improved multithread perf with perthread locale/MBCS state Added number of missing routines for Unicode string support 64 -bit time counter (_time 64_t) Many bug fixes and robustness issues addressed Source is 64 -bit compliant Aligned memory
Compiler Features l l Attributes Conformance Optimizations Runtime Checks
C++ Attributes l Declarative instructions for guiding implementation Ø Ø Ø l Hints to the compilation process Ø Ø l Encapsulate domain concepts in declarations Applies primarily to the declaration Look like MIDL attributes (square brackets) In-place or multi-site code transformations Like a compile-time Wizard Can have optional, named parameters
Attribute Implementation [soap_handler] class X { //. . . }; Compiler Linker Component Code Attributes Attribute provider The compiler calls the attribute provider with information about the class/method/member that has the attribute block. The attribute provider then injects code specific to that attribute.
Implementation Overview l Before [ trace(1) ] class CSome. Class { public: void mf() { //. . . } };
Implementation Overview l After class CSome. Class { public: void mf() { printf("Entering: CSome. Class: : mf()n"); //. . . printf("Leaving: CSome. Class: : mf()n"); } };
C++ Attribute Categories l l IDL (dual, in, out, etc. ) COM (coclass, progid, etc. ) Ø l l Registration Database (db_column, db_source, etc. ) Ø l l l Merges. CPP, . IDL, etc. into your. CPP files Ole. DB Consumer ATL Server Performance Monitor Unified Event Model Ø Makes it easy to implement event handling
Attribute Demo
C++ Conformance l l l l Covariant return types Template template parameters C library functions in standard namespace For-loop variable scoping Function Try block syntax support Uncaught_exception implemented In place initialization static const members supported
Neat Compiler Features l l l l /show. Includes /Wall /Wp 64 __FUNCTION__ __FUNCSIG__ __FUNCUNDNAME__ _MSC_VER
Code Optimization l Link time code generation Ø Ø Ø l l Double alignment Custom calling conventions Cross module inlining Loop unrolling Much better inlining heuristics (now on by default for /O 2)
Perf Improvements
Runtime Checks l l Stack checks Unitialized Locals Shortened converts (not on by default) Buffer overrun checks (very small overhead; used in retail builds)
New Processor Support l l l Code generation targeted to more recent chips (Pentium II, Pentium III, some Pentium 4) Support for processor specific intrinsics and inline assembly Available in VC 6 as Processor Pack
Processor Pack Features l l l New headers for intrinsics and defines Compiler intrinsics Compiler inline assembly Updated MASM Explicit Data Alignment Ø Ø Ø l __declspec(align()) __alignof() malloc/free routines Exception handling
Processor Pack Features l l l Register viewing in debugger Disasm in debugger New types Ø Ø l __m 64 __m 128 d __m 128 i Updated documentation
Processor Pack Samples
More General Code l Prefetch Ø l Structure alignment Ø l Can load one cache line of data to the L 1 cache Example – if you define a structure less than 32 bytes, you may want to align it to 32 bytes to ensure that objects of that structure type are efficiently cached SIMD Ø Ø Load/store multiple data objects at the same time Do repetitive operations in parallel
Modifications l l l Use vectorized SSE to do 4 floating point computations at one time Prefetch cache line before use Stream write through (don’t pollute cache) the result
Perf Gains For Example Execution time cut by more than 2/3!