Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
DO NOT REPEAT YOURSELF
Search
Marco Sero
March 13, 2015
Programming
0
390
DO NOT REPEAT YOURSELF
Leverage the power of C++ and Djinni to write native cross platform code on iOS and Android
Marco Sero
March 13, 2015
Tweet
Share
More Decks by Marco Sero
See All by Marco Sero
Working on a Legacy App
marcosero
3
3.3k
Event Detection
marcosero
1
1.6k
Other Decks in Programming
See All in Programming
Introduce Hono CLI
yusukebe
6
3k
Things You Thought You Didn’t Need To Care About That Have a Big Impact On Your Job
hollycummins
0
250
品質ワークショップをやってみた
nealle
0
610
Google Opalで使える37のライブラリ
mickey_kubo
3
130
Vueのバリデーション、結局どれを選べばいい? ― 自作バリデーションの限界と、脱却までの道のり ― / Which Vue Validation Library Should We Really Use? The Limits of Self-Made Validation and How I Finally Moved On
neginasu
2
300
SwiftDataを使って10万件のデータを読み書きする
akidon0000
0
240
理論と実務のギャップを超える
eycjur
0
170
20251016_Rails News ~Rails 8.1の足音を聴く~
morimorihoge
2
670
Reactive Thinking with Signals and the Resource API
manfredsteyer
PRO
0
100
AI 駆動開発におけるコミュニティと AWS CDK の価値
konokenj
4
140
CSC509 Lecture 06
javiergs
PRO
0
260
釣り地図SNSにおける有料機能の実装
nokonoko1203
0
200
Featured
See All Featured
Context Engineering - Making Every Token Count
addyosmani
7
290
The Language of Interfaces
destraynor
162
25k
Art, The Web, and Tiny UX
lynnandtonic
303
21k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
990
Large-scale JavaScript Application Architecture
addyosmani
514
110k
Making the Leap to Tech Lead
cromwellryan
135
9.6k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
Into the Great Unknown - MozCon
thekraken
40
2.1k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
190
55k
How STYLIGHT went responsive
nonsquared
100
5.8k
Docker and Python
trallard
46
3.6k
Speed Design
sergeychernyshev
32
1.2k
Transcript
DO NOT REPEAT YOURSELF
IOS AND ANDROID HAVE SOMETHING IN COMMON
C++
BUT USING IT... IT'S NOT GREAT
Objective-C++ on iOS JNI (Java Native Interface) on Android
UNTIL...
DJINNI BY
.djinni interface + C++ implementation Djinni JAVA AND OBJECTIVE-C INTERFACES
THE HACK
SHARED C++ IMAGE CACHE
DEFINE INTERFACE IN A .djinni FILE image_cache = interface +c
{ static create_with_path(path: string): image_cache; image_for_key(key: string): binary; save_image_for_key(key: string, image_data: binary); }
IMPLEMENT IT IN C++ shared_ptr<ImageCache> ImageCache::create_with_path(const std::string &path) { ...
} vector<uint8_t> ImageCache::image_for_key(const string &key) { ... } void ImageCache::save_image_for_key(const string &key, const vector<uint8_t> &image_data) { ... }
USE IT FROM OBJECTIVE-C id<YCCPImageCache> imageCache = [YCPPImageCacheCppProxy createWithPath:cachePath]; NSData
*imageData = [imageCache imageForKey:cacheKey]; [imageCache saveImageForKey:cacheKey imageData:imageData]; AND JAVA ImageCache imageCache = ImageCache.createWithPath(cachePath); byte[] imageBlob = this.imageCache.imageForKey(cacheKey); imageCache.saveImageForKey(cacheKey, imageBlob);
NEVER WRITE JNI AND OBJECTIVE-C++ AGAIN
SHARE NATIVE CODE BETWEEN PLATFORMS MORE EASILY
DO I RECOMMEND THIS?
NO AT LEAST FOR OUR APPS
THANK YOU.