Skip to content

v0.5.3

Choose a tag to compare

@m3m0r7 m3m0r7 released this 22 Jun 02:07

Runtime extension composition

Pnlx\Runtime::compose([Libsdl::class, Sdlimage::class]) fuses several generated
extensions into one shared FFI scope, so a \FFI\CData returned by one package
(e.g. an SDL2_image surface from IMG_Load) can be passed straight into another
package's function (SDL_CreateTextureFromSurface). Previously each extension
booted its own FFI::cdef scope and PHP FFI rejected cross-scope CData.

  • Members' generated cdefs are merged (Pnlx\FFI\CdefComposer) and their libraries
    co-loaded into a single NativeLibrary (NativeLibrary::composite()); each member
    class adopts that scope (AbstractExtension::pnlxAdoptNativeLibrary()), so its
    generated methods keep marshalling and return-wrapping unchanged — only the native
    scope is shared.
  • Returns a Pnlx\ComposedScope that also proxies calls
    (Runtime::compose([A, B])->some_function(...)); plain A::fn() / B::fn() static
    calls share the scope too.

Code generation

  • Pointer-to-const scalars (const int *, const double *) are now treated as
    read-only input arrays instead of writable by-reference out-params — fixes passing
    null where PHP cannot pass a literal by reference (libopenal/libswscale).
  • Structs defined with a body always get a Types\* wrapper now, even when no
    function names them, so a struct handed back through void * (hiredis's
    redisReply) can be re-wrapped.
  • Generated enums gain toInt() (alias of ->value), mirroring the integer-wrapper
    API of scalar returns.
  • Typed wrappers reinterpret() an incoming \FFI\CData to their own type.

Native-library resolution

  • pkg-config lookup also tries a lib-prefixed module name (enet -> libenet).
  • Headers living under include/<pkg>/ add the include root to the parse path, so
    angle includes carrying the subdir prefix resolve (lzo's <lzo/lzodefs.h>).

Build / runtime

  • The embedded PHP SDK (include_dir!) is rebuilt whenever any src/sdk file
    changes, via a build-script content fingerprint — SDK fixes always ship in the
    binary instead of silently going stale.
  • Pnlx\Util::isNull() added as a static null-pointer check for generated code.