Welcome back to C++ RValue referencesForward declared enumsBidirectional fences...

Preview:

Citation preview

Peter Torr, ptorr@microsoft.comProgram Manager, Windows Phone Developer Platform

Using C++ in your Windows Phone Applications

Agenda

C++ support in Windows Phone 8

When and why to use C++

Introduction to Windows (Phone) Runtime

~30 minutes of demos!

Welcome back to C++

C++ support in Windows Phone 8Visual C++ 2012

Same as Windows 8

New C++11 features

A sampling of C++ language features supported in Windows Phone 8

C++ support in Windows Phone 8

RValue references Forward declared enums Bidirectional fences

static_assert AlignmentData-dependency ordering

AutoStandard-layout and trivial types

exception_ptr

Trailing return types

Extended friend declarations Thread-local storage

LambdasLocal and unnamed types as template arguments

__func__

Decltype Range-based for-loop C99 preprocessor

Right angle brackets override and final long long

extern templates Minimal GC support

nullptr Atomics

Strongly typed enums Strong compare and exchange

Derived from http://msdn.microsoft.com/en-us/library/hh567368.aspx

Brief walk-through of key C++ features

Direct3D default template

DEMO:Quick tour of C++ features

When and why to use C++

Using C++ in Windows Phone appsAll Windows Phone 8 apps can use native

code

Direct3D games: Pure native

XAML apps: Native compute + Direct3D

...but not all apps need to use native codeSee 3-046 for more on native games

Top 3 use cases for C++

There is no requirement to use C++ in your XAML apps

123

PerformanceReusabilityPortability

Using legacy code in Windows Phone 8 apps

DEMO:C++ code re-use

reinterpret_cast<Phone>(WindowsRuntime)

Introduction to Windows (Phone) Runtime

APIsInfrastructure

What is the Windows Runtime?

Core plumbing

Common type system

Standard programming

model

Windows Phone features

Libraries you write (or

license)

Projected to C++ and C# /

VB

When is the Windows Runtime used?Calling APIs

Native / Managed Interop

Direct3D game app model

Calling APIs from C#

Creating a component in C++ and using from C#

The magic of async

DEMO:Windows Runtime

Writing portable components

Sharing code across platforms

With iOS and Android:Standard C and C++Common librariesMiddleware providers

With Windows 8, add:Windows RuntimeWin32 and COM

See 3-043 for more on Windows 8 portability

Real-world example of common open source library

Another look at async

DEMO:Using SQLite in Windows Phone 8

Wrap-up

Key takeaways for using C++

All Windows Phone 8 apps can use C++

C++ enables portability and code re-use

Windows Runtime is the key to unlocking

APIs

Please fill out an evaluation form!

Related sessions (live or on-line)

Session

Title Speaker

3-046 Native C/C++ Game Development Sam George

3-047Networking, Bluetooth, and NFC Proximity for Developers Tim Laverty

3-043How to leverage your code across WP8 and Windows 8

Andrew Byrne et al

2-018 Photo and Lens Apps Eric Bennett

4-001The power of C++ - Project Austin(not phone specific, but a great talk)

Ale Contenti

© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.