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
12k
Introduction of php-ext by rust
ごく簡単なphp拡張をrustで作る手順
gong023
January 14, 2016
Tweet
Share
Other Decks in Programming
See All in Programming
Hanami and htmx
bkuhlmann
0
230
Git Lint
bkuhlmann
4
770
Going beyond Apache Parquet's default settings
xhochy
0
140
Milestoner
bkuhlmann
1
420
Azure OpenAI Serviceのプロンプトエンジニアリング入門
tomokusaba
3
940
MicrosoftのPlatform Engineeringガイドを読んで実際になにかやってみた
ymd65536
1
530
AmperとFleetを使ったAndroidアプリ
yoppie
0
280
大規模Reactアプリのリアーキテクチャ~8万行のTanStack Query移行の軌跡~
kj455
4
1k
使ってみよう Azure AI Document Intelligence
kosmosebi
2
370
Native Federation: The Future of Micro Frontends in Angular
manfredsteyer
PRO
0
140
Docker_OSS_ホスティング入門
satokoki645
0
110
Go製Webアプリケーションのエラーとの向き合い方大全、あるいはやっぱりスタックトレース欲しいやん / Kyoto.go #50
utgwkk
6
1.9k
Featured
See All Featured
Code Review Best Practice
trishagee
56
15k
Stop Working from a Prison Cell
hatefulcrawdad
267
19k
Designing Experiences People Love
moore
136
23k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
117
18k
Done Done
chrislema
178
15k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
245
20k
Bash Introduction
62gerente
605
210k
Product Roadmaps are Hard
iamctodd
45
9.8k
Learning to Love Humans: Emotional Interface Design
aarron
267
39k
10 Git Anti Patterns You Should be Aware of
lemiorhan
649
58k
It's Worth the Effort
3n
180
27k
Thoughts on Productivity
jonyablonski
60
3.9k
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/