Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Introduction of php-ext by rust

gong023
January 14, 2016

Introduction of php-ext by rust

ごく簡単なphp拡張をrustで作る手順

gong023

January 14, 2016
Tweet

Other Decks in Programming

Transcript

  1. rust is • supported by Mozilla • to replace Firefox

    engine • better C++ • golang is better C
  2. Overview 1. Create shared object file by rust 2. Test

    shared object file by C 3. Link shared object file from php-ext
  3. Create .so file by rust 1. cargo new 2. write

    a function in rust 3. cargo build • you can get *.so file
  4. 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
  5. Link .so file from php-ext 1. Create php-ext by ext-skel

    2. Edit config.m4 and configure • difficult…
  6. 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
  7. 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