Skip to content

Releases: wildfluss/php-ext-hello-rs

Module is now compiled into PHP

21 Oct 22:02
Compare
Choose a tag to compare
Pre-release

PHP extension template in Rust

This is port to Rust of what PHP script ext_skel generates in C

Shows how

  • export Rust function to C
  • have global C struct _zend_module_entry in Rust and pass pointer to C
  • uses cdylib and prefer-dynamic (and link-arg=-undefined link-arg=dynamic_lookup on OSX)
  • how to call Zend API from Rust
  • how to port C Zend macro to Rust (e.g. RETURN_STR and PHP_FE_END)

TBC

$ php -d extension=./target/debug/libhello.dylib -f hello.php
Functions available in the test extension:
confirm_hello_compiled

Congratulations! You have successfully modified ext/hello/config.m4. Module hello is now compiled into PHP.