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
Introduction of php-ext by rust
Search
gong023
January 14, 2016
Programming
0
13k
Introduction of php-ext by rust
ごく簡単なphp拡張をrustで作る手順
gong023
January 14, 2016
Tweet
Share
Other Decks in Programming
See All in Programming
ZJIT: The Ruby 4 JIT Compiler / Ruby Release 30th Anniversary Party
k0kubun
1
300
Tinkerbellから学ぶ、Podで DHCPをリッスンする手法
tomokon
0
150
HTTPプロトコル正しく理解していますか? 〜かわいい猫と共に学ぼう。ฅ^•ω•^ฅ ニャ〜
hekuchan
2
580
公共交通オープンデータ × モバイルUX 複雑な運行情報を 『直感』に変換する技術
tinykitten
PRO
0
180
2年のAppleウォレットパス開発の振り返り
muno92
PRO
0
130
Navigating Dependency Injection with Metro
l2hyunwoo
1
200
Giselleで作るAI QAアシスタント 〜 Pull Requestレビューに継続的QAを
codenote
0
320
認証・認可の基本を学ぼう後編
kouyuume
0
260
令和最新版Android Studioで化石デバイス向けアプリを作る
arkw
0
470
Java 25, Nuevas características
czelabueno
0
120
Go コードベースの構成と AI コンテキスト定義
andpad
0
150
AI Agent Tool のためのバックエンドアーキテクチャを考える #encraft
izumin5210
5
1.5k
Featured
See All Featured
sira's awesome portfolio website redesign presentation
elsirapls
0
98
Typedesign – Prime Four
hannesfritz
42
2.9k
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
140
Evolving SEO for Evolving Search Engines
ryanjones
0
89
Embracing the Ebb and Flow
colly
88
4.9k
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
0
34
Build your cross-platform service in a week with App Engine
jlugia
234
18k
Test your architecture with Archunit
thirion
1
2.1k
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
56
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
0
170
AI: The stuff that nobody shows you
jnunemaker
PRO
1
37
[RailsConf 2023] Rails as a piece of cake
palkan
58
6.2k
Transcript
Introduction of php-ext by rust
About me • gong023 • https://github.com/gong023/ • PHP developer of
• #mercari_wakate??
I — PHP
Interested in rust
rust is • supported by Mozilla • to replace Firefox
engine • better C++ • golang is better C
rust is good because…
Safe memory You can compile errors with dangerous memory operations
Safe memory You can compile errors with dangerous memory operations
Modern syntax • Optional
Modern syntax • Generics & Traits
create php-ext by rust
Overview 1. Create shared object file by rust 2. Test
shared object file by C 3. Link shared object file from php-ext
Create .so file by rust 1. cargo new 2. write
a function in rust 3. cargo build • you can get *.so file
Test .so file by C 1. Write test code in
C 2. Include .so and compile C test code • Don’t forget to link shared object • gcc test.c -L SO_PATH -php_ext
Link .so file from php-ext 1. Create php-ext by ext-skel
2. Edit config.m4 and configure • difficult…
Link .so file from php-ext • Edit config.m4 I don’t
know why it doesn’t work
Link .so file from php-ext • Edit config.m4 I added
a path ignoring errors
Link .so file from php-ext 3. Write .h and .c
in php-ext • see references to know more details 4. make && make install 5. Test
Advanced • I tried to export rust-carbon to php-ext •
https://github.com/gong023/rust-carbon • But I don’t succeed yet. I don’t know why it doesn’t work
References • http://hermanradtke.com/2015/08/03/ creating-a-php-extension-to-rust.html • https://github.com/hjr3/rust-php-ext • http://postd.cc/creating-a-php-extension-in- rust/