SlideShare a Scribd company logo
1 of 20
Cross-Platform C++
for TV and Mobile Apps
1/26/2016
© 2016 Stephen Spann
demic apps LLC
Agenda
1. Mobile C++ Overview
2. Cross-Platform C++ Architecture with Djinni
3. Other C++ Tools for Android
4. Q&A
Image Credit: Toni Rodrigo
About Me
Background in web development, with iOS and Java experience 2007-2015
Began working with Cross-Platform C++ in July 2015
Mobile C++ Tutorials
mobilecpptutorials.com
Cross-Platform TV App: imperson8
imperson8.com
Mobile C++ Overview
What is C++?
Designed by Bjarne Stroustrup at Bell labs in 1983
Extension of the C Language (++ as in numerical increment)
Used in all sorts of applications from Robots to Gaming
Known for high performance
C++ Advantages
It’s been around a long time... yay!
Plenty of troubleshooting info on the Internet
Many open-source libraries available (OpenCV, Boost, etc)
Good for apps that have heavy use of databases, APIs, etc.
Great for new apps, cross-platform Prototypes and MVPs
Unit testing across all platforms
Utilize Native UI (better performance)
Works on TVs!
C++ Disadvantages
It’s been around a long time… boo!
Out-of-date information on the Internet
Multiple ways of accomplishing the same thing
Bad for apps that are primarily UI
Difficult to migrate existing apps
Steep learning curve
Large number of languages and tools involved
Hard sell to clients/stakeholders
Who’s Doing It?
https://mobilecpp.slack.com/
Cross-Platform C++
Architecture
Cross-Platform C++ Architecture
Java
C++
Objective-C
JNI Objective-C++
“Back end” Code
● SQLite Database Code
● API Calls
● Analytics
“Front end” Code
● User Interface
● Animations
● Device Features
Bridge Code
No one likes writing bridge code!
● Error-prone
● Hard to troubleshoot
● Little to no documentation, syntax hints, etc
The Secret Sauce: Dropbox’s Djinni
● Configured with IDL Files (Interface Definition Language)
● Generates all needed bridge code: JNI and Objective-C++
● Creates idiomatic interfaces for C++, Java, and Objective-C
hello_world = interface +c {
static create(): hello_world;
get_hello_world(): string;
}
Djinni in Action: C++
hello_world.hpp
helloworld.djinni
Generated by Djinni
Handwritten
C++ Interface
hello_world_impl.cpp
hello_world_impl.hpp
IDL File
C++ Implementation
hello_world = interface +c {
static create(): hello_world;
get_hello_world(): string;
}
Djinni in Action: Java
NativeHelloWorld.hpp
helloworld.djinni
Generated by Djinni
Handwritten
JNI Bridge
IDL File
Java Interface(?)
NativeHelloWorld.cpp
HelloWorld.java
MainActivity.java Java Implementation
Other Tools
C++ Tools for Android
GYP (Generate Your Projects)
● Android no longer supported
● Have to write both GYP and
Make files
CMake
● Ideal for making reusable libraries
Experimental Gradle Plugin
● Build/include libraries and source
files all in Gradle
Android NDK
● Android’s libc (Bionic) has
several bugs
● Missing parts of the Standard
Libary (ex: std::thread and
std::mutex)
NDK OptionsBuilding Libraries
CrystaX NDK
● More C++ Support
● Bug fixes
Boost C++ Libraries
http://www.boost.org/
● Peer-reviewed by the C++ Community
● Boost libraries are often incorporated into the
C++ Standard Library
Can be difficult to integrate into Android/iOS, some helpful links:
Build Script for OS X/iOS: https://gist.github.com/faithfracture
Precompiled for tvOS: https://github.com/danoli3/ofxtvOSBoost
Android 3rd-Party NDK: https://www.crystax.net/
CrystaX NDK
https://www.crystax.net/
● Drop-in replacement for Google’s Android NDK
● Includes Boost Libraries
● Built-in C++11 and C++14 Support
● Includes missing elements from the Android NDK
(ex: std::thread and std::mutex)
● Includes most recent Clang and GCC Compilers
● Fixes to bugs in Android libc (Bionic)
Where to go from here?
Djinni and MX3 repos with examples:
https://github.com/dropbox/djinni
https://github.com/libmx3/mx3
Mobile C++ Tutorials:
http://mobilecpptutorials.com
Mobile C++ Slack Channel:
https://mobilecpp.slack.com/
CPP Con:
http://cppcon.org/
Contact Me
Stephen Spann
*demic apps LLC
spann@demicapps.com
@spanndemic

More Related Content

What's hot

Mono + .NET Core = ❤️
Mono + .NET Core =  ❤️Mono + .NET Core =  ❤️
Mono + .NET Core = ❤️
Egor Bogatov
 
Разработка кросс-платформенного кода между iPhone < -> Windows с помощью o...
Разработка кросс-платформенного кода между iPhone < -> Windows с помощью o...Разработка кросс-платформенного кода между iPhone < -> Windows с помощью o...
Разработка кросс-платформенного кода между iPhone < -> Windows с помощью o...
Yandex
 
[COSCUP 2020] How to use llvm frontend library-libtooling
[COSCUP 2020] How to use llvm frontend library-libtooling[COSCUP 2020] How to use llvm frontend library-libtooling
[COSCUP 2020] How to use llvm frontend library-libtooling
Douglas Chen
 

What's hot (20)

C++ via C#
C++ via C#C++ via C#
C++ via C#
 
Mono + .NET Core = ❤️
Mono + .NET Core =  ❤️Mono + .NET Core =  ❤️
Mono + .NET Core = ❤️
 
Summary of C++17 features
Summary of C++17 featuresSummary of C++17 features
Summary of C++17 features
 
Introduction to OpenCV 3.x (with Java)
Introduction to OpenCV 3.x (with Java)Introduction to OpenCV 3.x (with Java)
Introduction to OpenCV 3.x (with Java)
 
Async await in C++
Async await in C++Async await in C++
Async await in C++
 
The Present and The Future of Functional Programming in C++
The Present and The Future of Functional Programming in C++The Present and The Future of Functional Programming in C++
The Present and The Future of Functional Programming in C++
 
Introduction to OpenCV (with Java)
Introduction to OpenCV (with Java)Introduction to OpenCV (with Java)
Introduction to OpenCV (with Java)
 
Go Programming Language (Golang)
Go Programming Language (Golang)Go Programming Language (Golang)
Go Programming Language (Golang)
 
C Under Linux
C Under LinuxC Under Linux
C Under Linux
 
Vladymyr Bahrii Understanding polymorphism in C++ 16.11.17
Vladymyr Bahrii Understanding polymorphism in C++ 16.11.17Vladymyr Bahrii Understanding polymorphism in C++ 16.11.17
Vladymyr Bahrii Understanding polymorphism in C++ 16.11.17
 
С++ without new and delete
С++ without new and deleteС++ without new and delete
С++ without new and delete
 
Android antipatterns
Android antipatternsAndroid antipatterns
Android antipatterns
 
Разработка кросс-платформенного кода между iPhone < -> Windows с помощью o...
Разработка кросс-платформенного кода между iPhone < -> Windows с помощью o...Разработка кросс-платформенного кода между iPhone < -> Windows с помощью o...
Разработка кросс-платформенного кода между iPhone < -> Windows с помощью o...
 
Not Your Fathers C - C Application Development In 2016
Not Your Fathers C - C Application Development In 2016Not Your Fathers C - C Application Development In 2016
Not Your Fathers C - C Application Development In 2016
 
GCC, GNU compiler collection
GCC, GNU compiler collectionGCC, GNU compiler collection
GCC, GNU compiler collection
 
Jython: Integrating Python and Java
Jython: Integrating Python and JavaJython: Integrating Python and Java
Jython: Integrating Python and Java
 
A Python Tutorial
A Python TutorialA Python Tutorial
A Python Tutorial
 
Review: Apitrace and Vogl
Review: Apitrace and VoglReview: Apitrace and Vogl
Review: Apitrace and Vogl
 
Go. Why it goes
Go. Why it goesGo. Why it goes
Go. Why it goes
 
[COSCUP 2020] How to use llvm frontend library-libtooling
[COSCUP 2020] How to use llvm frontend library-libtooling[COSCUP 2020] How to use llvm frontend library-libtooling
[COSCUP 2020] How to use llvm frontend library-libtooling
 

Viewers also liked

Sharing up to 80% code for iOS, Android, and Windows platforms, a Retail App ...
Sharing up to 80% code for iOS, Android, and Windows platforms, a Retail App ...Sharing up to 80% code for iOS, Android, and Windows platforms, a Retail App ...
Sharing up to 80% code for iOS, Android, and Windows platforms, a Retail App ...
Xamarin
 
Learning Analytics - What Do Stakeholders Really Think?
Learning Analytics - What Do Stakeholders Really Think?Learning Analytics - What Do Stakeholders Really Think?
Learning Analytics - What Do Stakeholders Really Think?
Neil Witt
 
bti asia salary guide
bti asia salary guidebti asia salary guide
bti asia salary guide
Febrian ‎
 

Viewers also liked (20)

Sharing up to 80% code for iOS, Android, and Windows platforms, a Retail App ...
Sharing up to 80% code for iOS, Android, and Windows platforms, a Retail App ...Sharing up to 80% code for iOS, Android, and Windows platforms, a Retail App ...
Sharing up to 80% code for iOS, Android, and Windows platforms, a Retail App ...
 
Cross Platform Mobile Development with Visual Studio 2015 and C++
Cross Platform Mobile Development with Visual Studio 2015 and C++Cross Platform Mobile Development with Visual Studio 2015 and C++
Cross Platform Mobile Development with Visual Studio 2015 and C++
 
Mobile Cross-Platform Development in C++
Mobile Cross-Platform Development in C++Mobile Cross-Platform Development in C++
Mobile Cross-Platform Development in C++
 
Life Sciences: Career Development in Europe and Asia
Life Sciences: Career Development in Europe and AsiaLife Sciences: Career Development in Europe and Asia
Life Sciences: Career Development in Europe and Asia
 
Introduction to Go language
Introduction to Go languageIntroduction to Go language
Introduction to Go language
 
Agile cost estimation
Agile cost estimationAgile cost estimation
Agile cost estimation
 
Learning Analytics - What Do Stakeholders Really Think?
Learning Analytics - What Do Stakeholders Really Think?Learning Analytics - What Do Stakeholders Really Think?
Learning Analytics - What Do Stakeholders Really Think?
 
Agile Methodologies and Cost Estimation
Agile Methodologies and Cost EstimationAgile Methodologies and Cost Estimation
Agile Methodologies and Cost Estimation
 
Software engineer
Software engineerSoftware engineer
Software engineer
 
bti asia salary guide
bti asia salary guidebti asia salary guide
bti asia salary guide
 
Southeast Indonesia: A guide for investors and developers in Lombok, Sumbawa,...
Southeast Indonesia: A guide for investors and developers in Lombok, Sumbawa,...Southeast Indonesia: A guide for investors and developers in Lombok, Sumbawa,...
Southeast Indonesia: A guide for investors and developers in Lombok, Sumbawa,...
 
GO Mobile presentation for English Language Centre at the University of Liver...
GO Mobile presentation for English Language Centre at the University of Liver...GO Mobile presentation for English Language Centre at the University of Liver...
GO Mobile presentation for English Language Centre at the University of Liver...
 
Developing a technology enhanced learning strategy
Developing a technology enhanced learning strategyDeveloping a technology enhanced learning strategy
Developing a technology enhanced learning strategy
 
Natural Resources: Career Development in Europe and Asia
Natural Resources: Career Development in Europe and AsiaNatural Resources: Career Development in Europe and Asia
Natural Resources: Career Development in Europe and Asia
 
Estimation or, "How to Dig your Grave"
Estimation or, "How to Dig your Grave"Estimation or, "How to Dig your Grave"
Estimation or, "How to Dig your Grave"
 
Open Minded? Software Engineer to a UX Engineer. Ask me how. by Micael Diaz d...
Open Minded? Software Engineer to a UX Engineer. Ask me how. by Micael Diaz d...Open Minded? Software Engineer to a UX Engineer. Ask me how. by Micael Diaz d...
Open Minded? Software Engineer to a UX Engineer. Ask me how. by Micael Diaz d...
 
Project-Based Instruction and the Importance of Self-Directed Learning
Project-Based Instruction and the Importance of Self-Directed LearningProject-Based Instruction and the Importance of Self-Directed Learning
Project-Based Instruction and the Importance of Self-Directed Learning
 
#CodingL1: Coding as a (second) mother language
#CodingL1: Coding as a (second) mother language#CodingL1: Coding as a (second) mother language
#CodingL1: Coding as a (second) mother language
 
Spark Streaming Tips for Devs and Ops by Fran perez y federico fernández
Spark Streaming Tips for Devs and Ops by Fran perez y federico fernándezSpark Streaming Tips for Devs and Ops by Fran perez y federico fernández
Spark Streaming Tips for Devs and Ops by Fran perez y federico fernández
 
Code Drives the World
Code Drives the WorldCode Drives the World
Code Drives the World
 

Similar to Mobile C++

CVformicrosoft
CVformicrosoftCVformicrosoft
CVformicrosoft
momofarm
 

Similar to Mobile C++ (20)

Programming in c plus plus2
Programming in c plus plus2Programming in c plus plus2
Programming in c plus plus2
 
Lviv MD Day 2015 Ігор Кантор "Розробка додатків зі спільним C++ кодом для iOS...
Lviv MD Day 2015 Ігор Кантор "Розробка додатків зі спільним C++ кодом для iOS...Lviv MD Day 2015 Ігор Кантор "Розробка додатків зі спільним C++ кодом для iOS...
Lviv MD Day 2015 Ігор Кантор "Розробка додатків зі спільним C++ кодом для iOS...
 
Mobile Development with Visual Studio by Sergey Seletsky
Mobile Development with Visual Studio by Sergey SeletskyMobile Development with Visual Studio by Sergey Seletsky
Mobile Development with Visual Studio by Sergey Seletsky
 
Alvaro Denis Resume
Alvaro Denis ResumeAlvaro Denis Resume
Alvaro Denis Resume
 
Mobile development with visual studio
Mobile development with visual studioMobile development with visual studio
Mobile development with visual studio
 
Session 1 - c++ intro
Session   1 - c++ introSession   1 - c++ intro
Session 1 - c++ intro
 
Presentation of programming languages for beginners
Presentation of programming languages for beginnersPresentation of programming languages for beginners
Presentation of programming languages for beginners
 
Unit 1 of c++ part 1 basic introduction
Unit 1 of c++ part 1 basic introductionUnit 1 of c++ part 1 basic introduction
Unit 1 of c++ part 1 basic introduction
 
C# rocks
C# rocksC# rocks
C# rocks
 
Programming In Linux Presentation
Programming In Linux PresentationProgramming In Linux Presentation
Programming In Linux Presentation
 
C++ TRAINING IN AMBALA CANTT! BATRA COMPUTER CENTER
C++ TRAINING IN AMBALA CANTT! BATRA COMPUTER CENTERC++ TRAINING IN AMBALA CANTT! BATRA COMPUTER CENTER
C++ TRAINING IN AMBALA CANTT! BATRA COMPUTER CENTER
 
CuongDang_CV
CuongDang_CVCuongDang_CV
CuongDang_CV
 
CVformicrosoft
CVformicrosoftCVformicrosoft
CVformicrosoft
 
C++ Kasirul Rashtawi Institute.pdf
C++ Kasirul Rashtawi Institute.pdfC++ Kasirul Rashtawi Institute.pdf
C++ Kasirul Rashtawi Institute.pdf
 
Android | Xamarin | Mobile Application development
Android | Xamarin | Mobile Application developmentAndroid | Xamarin | Mobile Application development
Android | Xamarin | Mobile Application development
 
All good things scale - ohs 2020 - 03.13.2020
All good things scale - ohs 2020 - 03.13.2020All good things scale - ohs 2020 - 03.13.2020
All good things scale - ohs 2020 - 03.13.2020
 
All You Need To Know About C Program Assignment Help.pdf
All You Need To Know About C Program Assignment Help.pdfAll You Need To Know About C Program Assignment Help.pdf
All You Need To Know About C Program Assignment Help.pdf
 
C++ in our world
C++ in our worldC++ in our world
C++ in our world
 
RAD Studio, Delphi and C++Builder 10 Feature Matrix
RAD Studio, Delphi and C++Builder 10 Feature MatrixRAD Studio, Delphi and C++Builder 10 Feature Matrix
RAD Studio, Delphi and C++Builder 10 Feature Matrix
 
Introduction to C++
Introduction to C++Introduction to C++
Introduction to C++
 

Recently uploaded

AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
VishalKumarJha10
 

Recently uploaded (20)

%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 

Mobile C++

  • 1. Cross-Platform C++ for TV and Mobile Apps 1/26/2016 © 2016 Stephen Spann demic apps LLC
  • 2. Agenda 1. Mobile C++ Overview 2. Cross-Platform C++ Architecture with Djinni 3. Other C++ Tools for Android 4. Q&A Image Credit: Toni Rodrigo
  • 3. About Me Background in web development, with iOS and Java experience 2007-2015 Began working with Cross-Platform C++ in July 2015 Mobile C++ Tutorials mobilecpptutorials.com Cross-Platform TV App: imperson8 imperson8.com
  • 5. What is C++? Designed by Bjarne Stroustrup at Bell labs in 1983 Extension of the C Language (++ as in numerical increment) Used in all sorts of applications from Robots to Gaming Known for high performance
  • 6. C++ Advantages It’s been around a long time... yay! Plenty of troubleshooting info on the Internet Many open-source libraries available (OpenCV, Boost, etc) Good for apps that have heavy use of databases, APIs, etc. Great for new apps, cross-platform Prototypes and MVPs Unit testing across all platforms Utilize Native UI (better performance) Works on TVs!
  • 7. C++ Disadvantages It’s been around a long time… boo! Out-of-date information on the Internet Multiple ways of accomplishing the same thing Bad for apps that are primarily UI Difficult to migrate existing apps Steep learning curve Large number of languages and tools involved Hard sell to clients/stakeholders
  • 10. Cross-Platform C++ Architecture Java C++ Objective-C JNI Objective-C++ “Back end” Code ● SQLite Database Code ● API Calls ● Analytics “Front end” Code ● User Interface ● Animations ● Device Features Bridge Code
  • 11. No one likes writing bridge code! ● Error-prone ● Hard to troubleshoot ● Little to no documentation, syntax hints, etc
  • 12. The Secret Sauce: Dropbox’s Djinni ● Configured with IDL Files (Interface Definition Language) ● Generates all needed bridge code: JNI and Objective-C++ ● Creates idiomatic interfaces for C++, Java, and Objective-C
  • 13. hello_world = interface +c { static create(): hello_world; get_hello_world(): string; } Djinni in Action: C++ hello_world.hpp helloworld.djinni Generated by Djinni Handwritten C++ Interface hello_world_impl.cpp hello_world_impl.hpp IDL File C++ Implementation
  • 14. hello_world = interface +c { static create(): hello_world; get_hello_world(): string; } Djinni in Action: Java NativeHelloWorld.hpp helloworld.djinni Generated by Djinni Handwritten JNI Bridge IDL File Java Interface(?) NativeHelloWorld.cpp HelloWorld.java MainActivity.java Java Implementation
  • 16. C++ Tools for Android GYP (Generate Your Projects) ● Android no longer supported ● Have to write both GYP and Make files CMake ● Ideal for making reusable libraries Experimental Gradle Plugin ● Build/include libraries and source files all in Gradle Android NDK ● Android’s libc (Bionic) has several bugs ● Missing parts of the Standard Libary (ex: std::thread and std::mutex) NDK OptionsBuilding Libraries CrystaX NDK ● More C++ Support ● Bug fixes
  • 17. Boost C++ Libraries http://www.boost.org/ ● Peer-reviewed by the C++ Community ● Boost libraries are often incorporated into the C++ Standard Library Can be difficult to integrate into Android/iOS, some helpful links: Build Script for OS X/iOS: https://gist.github.com/faithfracture Precompiled for tvOS: https://github.com/danoli3/ofxtvOSBoost Android 3rd-Party NDK: https://www.crystax.net/
  • 18. CrystaX NDK https://www.crystax.net/ ● Drop-in replacement for Google’s Android NDK ● Includes Boost Libraries ● Built-in C++11 and C++14 Support ● Includes missing elements from the Android NDK (ex: std::thread and std::mutex) ● Includes most recent Clang and GCC Compilers ● Fixes to bugs in Android libc (Bionic)
  • 19. Where to go from here? Djinni and MX3 repos with examples: https://github.com/dropbox/djinni https://github.com/libmx3/mx3 Mobile C++ Tutorials: http://mobilecpptutorials.com Mobile C++ Slack Channel: https://mobilecpp.slack.com/ CPP Con: http://cppcon.org/
  • 20. Contact Me Stephen Spann *demic apps LLC spann@demicapps.com @spanndemic