TypePHP 编译器 https://swoole.com/aot/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
韩天峰 2bad099e09 feat(generator): add yield and generator support using Fiber backend 2 months ago
..
cpp-src feat(generator): add yield and generator support using Fiber backend 2 months ago
include feat(build): add library build mode with proper target naming 2 months ago
php-src feat(build): add support for building shared libraries in addition to binaries and extensions 2 months ago
README.md feat(build): add library build mode with proper target naming 2 months ago
project.yml feat(build): add library build mode with proper target naming 2 months ago
smoke-test.cc feat(build): add library build mode with proper target naming 2 months ago

README.md

lib-demo

This example compiles TypePHP code into a shared library and exposes a stable C ABI.

Build it from the repository root:

php bin/compiler.php examples/lib-demo/project.yml --no-progress

The resulting library uses the configured project name: currently libdemo.so on Linux, libdemo.dylib on macOS, and demo.dll on Windows. Set output: demo.so in project.yml to use an exact output filename. Its public API is declared in include/typephp_lib_demo.h.

On Linux, validate the library can be linked and called:

g++ -std=c++17 examples/lib-demo/smoke-test.cc -Iexamples/lib-demo \
  ./libdemo.so -Wl,-rpath,'$ORIGIN' -o lib-demo-smoke
./lib-demo-smoke

typephp_lib_demo_add() initializes the embedded PHP runtime on its first call. The runtime remains process-global for the lifetime of the library; do not call it concurrently with the first invocation.