Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Going Native with FFI
Search
Juan Carlos Ruiz González
September 20, 2019
Programming
0
310
Going Native with FFI
Slides of my Talk given at RubyConf Colombia 2019
Juan Carlos Ruiz González
September 20, 2019
Tweet
Share
More Decks by Juan Carlos Ruiz González
See All by Juan Carlos Ruiz González
Por qué elegir Rails en 2024
juancrg90
0
11
Surviving to third-party integrations - Ruby Peru Meetup
juancrg90
0
130
Going Native With FFI - Euruko 2021
juancrg90
0
56
Ecommerce en Rails con Solidus
juancrg90
0
120
Other Decks in Programming
See All in Programming
Why Kotlin? 電子カルテを Kotlin で開発する理由 / Why Kotlin? at Henry
agatan
2
7.2k
関数実行の裏側では何が起きているのか?
minop1205
1
690
AIコードレビューがチームの"文脈"を 読めるようになるまで
marutaku
0
350
tparseでgo testの出力を見やすくする
utgwkk
2
220
tsgolintはいかにしてtypescript-goの非公開APIを呼び出しているのか
syumai
6
2.2k
JETLS.jl ─ A New Language Server for Julia
abap34
1
400
20251127_ぼっちのための懇親会対策会議
kokamoto01_metaps
2
430
Rediscover the Console - SymfonyCon Amsterdam 2025
chalasr
2
160
AIコーディングエージェント(Gemini)
kondai24
0
220
Full-Cycle Reactivity in Angular: SignalStore mit Signal Forms und Resources
manfredsteyer
PRO
0
140
DevFest Android in Korea 2025 - 개발자 커뮤니티를 통해 얻는 가치
wisemuji
0
140
ID管理機能開発の裏側 高速にSaaS連携を実現したチームのAI活用編
atzzcokek
0
230
Featured
See All Featured
Unsuck your backbone
ammeep
671
58k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
1.8k
The Language of Interfaces
destraynor
162
25k
Code Review Best Practice
trishagee
74
19k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
249
1.3M
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
970
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
61k
It's Worth the Effort
3n
187
29k
GraphQLとの向き合い方2022年版
quramy
50
14k
Embracing the Ebb and Flow
colly
88
4.9k
Into the Great Unknown - MozCon
thekraken
40
2.2k
Transcript
GOING NATIVE WITH FFI Juan C. Ruiz
❏ Former software engineer @ MagmaLabs ❏ Remote work advocate
❏ RubyMe Q2 mentor ❏ I ❤ Open source @JuanCrg90
@JuanCrg90 Heroes' Causeway Arch Leon Guanajuato Photo By @marianozka
@JuanCrg90
@JuanCrg90
What are the options that we have to manage native
code on Ruby? @JuanCrg90
MKMF @JuanCrg90
@JuanCrg90 mkmf.rb is used by Ruby C extensions to generate
a Makefile which will correctly compile and link the C extension to Ruby and a third-party library.
library.h library.c @JuanCrg90
my_ruby_ext.c @JuanCrg90
extconf.rb @JuanCrg90
@JuanCrg90
@JuanCrg90
Pros: - We can use C functions in our Ruby
Code - We take advantage of the existing ruby.h library to create the extension Cons: - We need to add extra C code to create the bindings - This solution only works in MRI @JuanCrg90
FFI @JuanCrg90
A foreign function interface (FFI) is a mechanism by which
a program written in one programming language can call routines or make use of services written in another. @JuanCrg90
@JuanCrg90
Pros: - We don’t need to add additional C code
- An FFI extension is multi-platform and multi-implementation Cons: - Complex macros are difficult to maintain - Same for callback functions @JuanCrg90
PGM IMAGES @JuanCrg90
@JuanCrg90
@JuanCrg90
@JuanCrg90
@JuanCrg90
@JuanCrg90
@JuanCrg90
@JuanCrg90
@JuanCrg90
@JuanCrg90
@JuanCrg90
@JuanCrg90
@JuanCrg90
Conclusion @JuanCrg90
- https://github.com/JuanCrg90/my_ruby_ext - https://github.com/JuanCrg90/pgm_ffi @JuanCrg90
THANKS @JuanCrg90