|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2019-07-10 13:37 UTC] lisachenko dot it at gmail dot com
Description: ------------ I'm trying to import AST internal PHP functions with FFI, but for Windows platform this brings a lot of pain, because __vectorcall convention is used. It was introduced in https://github.com/php/php-src/commit/3b6cd5fe4ce81d3d219887339f3915140214708c Unfortunately, libffi doesn't support vectorcall convention, thus symbol could not be imported properly with FFI. Is it possible to remove such specific calling convention, used for ZEND_FASTCALL macros for 7.4.0 and just switch to traditional one: __fastcall for x32. For x64 platform Expected result: ---------------- All exported PHP functions don't use vectorcall convention anymore. Actual result: -------------- Some PHP functions are exported as vectorcall-functions (have double @@ at the end with number of additional bytes), for example, "zend_ast_evaluate@@24" and could not be imported with FFI under Windows platform. Patchesoverride-zend-fastcall (last revision 2019-07-22 10:56 UTC by cmb@php.net)Pull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 22 05:00:01 2025 UTC |
I've checked the source code of libffi. Zero lines about vectorcall, so unlikely that this convention is supported right now. x32 was typo, there should be "x86" of course. You can start debug this with simple attempt to import zend_atoi function under Windows platform which is declared as following: ZEND_API int ZEND_FASTCALL zend_atoi(const char *str, size_t str_len); Minimal reproduced case: <?php $vectorcallBug = FFI::cdef("extern int zend_atoi(const char *str, size_t str_len);", 'php7.dll'); $vectorcallBug->zend_atoi(); // Good if we can see an exception about invalid argument number But now we can get only this: Fatal error: Uncaught FFI\Exception: Failed resolving C function 'zend_atoi'