Skip to content

Windows support (x64) #59

Closed
1 of 1 issue completed
Closed

Description

@lisachenko

Goal

Support running z-engine on Windows x64. The runtime resolves FFI definitions by platform key, so the work is generating and validating windows-x64 artifacts and handling the Windows-specific symbol loading.

What's needed

  • Header generation on Windows. emit.php relies on clang, cpp/clang -E, php-config and a C compiler. On Windows this needs the PHP SDK toolchain (or clang-cl) and the PHP dev pack headers. generate.php's Docker orchestration is Linux-only; a Windows path (native or a Windows CI runner) is required.
  • Symbol loading. Unlike Linux/macOS (which resolve engine symbols from the running process), Windows needs FFI_LIB pointing at the PHP DLL (historically php7.dll; for PHP 8 it's php8ts.dll/php8.dll depending on the build). The generated header currently only emits FFI_SCOPE; the Windows generator will need to emit the correct FFI_LIB line, and Core will need to select it.
  • Calling convention. ZEND_FASTCALL maps to __vectorcall on Windows — verify the generated declarations handle this (the current generator strips it via cpp, which may or may not be correct for the ABI).
  • ZTS. Official Windows PHP builds are commonly thread-safe; this likely needs the ZTS runtime work (separate issue) as a prerequisite.

Acceptance

  • Generated include/8.4/windows-x64-*/* validated against a real Windows PHP 8.4 build
  • Symbol resolution via the correct PHP DLL
  • A Windows CI job runs at least the non-destructive suite

Part of the platform-support roadmap referenced in the README support matrix (see #57).

Activity

  1. added a commit that references this issue on Aug 8, 2026
  2. lisachenko commented on Aug 8, 2026

    @lisachenko
    OwnerAuthor

    All three acceptance criteria are now met on both release lines (#180 on 8.4, #182 on master):

    • Generated artifacts validated against real Windows PHP: include/8.4/windows-x64-{nts,zts} and include/8.5/windows-x64-{nts,zts} are generated on windows-latest runners from the official devel packs and layout-validated by FFI against the C compiler on every run.
    • Symbol resolution via the PHP DLL: the Windows headers emit FFI_LIB "php8.dll"|"php8ts.dll", Core::init() passes the DLL to FFI::cdef() explicitly, and ZEND_FASTCALL/__vectorcall symbols resolve through FFI's name@@N export mangling — the 2019 blocker from Add Windows platform support #1 is gone in current PHP builds.
    • Windows CI: tests-windows runs the full suite (not just non-destructive) on both NTS and ZTS, plus header-drift-windows regeneration checks; all green on 8.4 and master.

    Both thread-safety modes are covered with no upstream gap (windows.php.net ships x64 NTS+ZTS for 8.4 and 8.5). Intentionally out of scope and tracked in #119: the opcache file-cache relocator on Windows and opcache.preload (which does not exist there).


    Generated by Claude Code

  3. lisachenko commented on Aug 9, 2026

    @lisachenko
    OwnerAuthor

    Implemented in #180

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions