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
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Marco Sero
March 13, 2015
Programming
450
0
Share
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
More Decks by Marco Sero
See All by Marco Sero
Working on a Legacy App
marcosero
3
3.4k
Event Detection
marcosero
1
1.7k
Other Decks in Programming
See All in Programming
新規プロダクトを高速で生み出すハーネスエンジニアリング
seanchas116
19
7.8k
OCRを使ってゲームのアイテムをデータ化する
kishikawakatsumi
0
120
Make SRE Operations Easier with Azure SRE Agent
kkamegawa
0
2.7k
AI駆動開発で崩れていくコードベースを立て直す
kyoko_nr_nr
1
410
Composerを使ったサプライチェーン攻撃の様子を眺めてみる #phpstudy
o0h
PRO
2
210
[KCD Czech] eBPF Meets the GPU: Future of AI Infra Observability
doniacld
0
130
AIとRubyの静的型付け
ukin0k0
0
500
プラグインで拡張される Context をtype-safe にする難しさと設計判断
kazupon
2
530
プロパティの順序で型推論が壊れる!? TypeScript6.0の修正からContext-Sensitivityの仕組みを追う
bicstone
2
1.3k
Lessons from Spec-Driven Development
simas
PRO
0
110
サーバーレスで作る、動画データ管理基盤
oyasumipants
0
330
JavaDoc 再入門
nagise
0
230
Featured
See All Featured
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
260
Building AI with AI
inesmontani
PRO
1
1k
Between Models and Reality
mayunak
4
320
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.7k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
160
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
830
Technical Leadership for Architectural Decision Making
baasie
3
390
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
390
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.5k
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.