Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preliminary Windows support #128

Merged
merged 34 commits into from
Mar 18, 2022
Merged

Preliminary Windows support #128

merged 34 commits into from
Mar 18, 2022

Conversation

davidcole1340
Copy link
Owner

Still some work to do but will use this to track progress.

Some caveats:

  • Rust nightly is required. PHP uses __vectorcall on some functions which is supported in Rust via the abi_vectorcall nightly feature.
  • Bindgen __vectorcall support has not been upstreamed yet and therefore requires using my fork.
  • Only PHP installations from windows.php.net are supported at this point in time.
  • You need to match MSVC (Microsoft Visual C++) versions with PHP. The extension must be linked with a MSVC version the same or earlier than the version of MSVC PHP was linked with. Visual Studio 2022 is not supported.
  • I don't think tests are passing at the moment on Windows.
  • If you manually define function handlers (i.e. ones that take Zend exceution data) you need to change to using the zend_fastcall! macro. Function handlers are __vectorcall on Windows and the macro will swap the ABI based on the target triple. Example:
// Before
pub extern "C" fn test_handler(ex: &mut ExecutionData, retval: &mut Zval) {
  // ...
}

// After
use ext_php_rs::zend_fastcall;

zend_fastcall! {
  pub extern fn test_handler(ex: &mut ExecutionData, retval: &mut Zval) {
    // ...
  }
}

@SQKo
Copy link

SQKo commented Mar 14, 2022

wintendo user here approves

@davidcole1340
Copy link
Owner Author

Some updates:

@davidcole1340 davidcole1340 linked an issue Mar 16, 2022 that may be closed by this pull request
@davidcole1340 davidcole1340 merged commit 664981f into master Mar 18, 2022
@davidcole1340 davidcole1340 deleted the windows branch March 20, 2022 22:41
@reeperbahnause
Copy link

Hi, I just tried to build the hello_world example on my local Windows but i still get the error regarding the missing php-config. Do you have a hint for what I'm missing?

@SQKo
Copy link

SQKo commented May 13, 2022

Hi, I just tried to build the hello_world example on my local Windows but i still get the error regarding the missing php-config. Do you have a hint for what I'm missing?

Hey, It's working for me on windows.
Are you using the latest master branch? Try it

Otherwise please post the details of the errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Windows support
3 participants