diff --git a/README.md b/README.md index f25ab0f..6742f72 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,13 @@ # php FFI Extend Call PHP C API -__Note: On windows, can be define constant `PHP_DLL_FILE_PATH` for specify `php7.dll` or `php7ts.dll` path__ +php DLL(php7.dll,php7ts) find: + * like unix os, Usually does not require additional loading + * windows, + * first, load user constant `PHP_DLL_FILE_PATH` + * second, load directory of predefined constant `PHP_BINARY` + * third, load php parent directory of ext directory +__Note: constant `PHP_DLL_FILE_PATH` work for like unix OS # Reference ### class `Toknot\FFIExtend` of methods diff --git a/src/FFIExtend.php b/src/FFIExtend.php index 7f87f55..f28809e 100644 --- a/src/FFIExtend.php +++ b/src/FFIExtend.php @@ -136,7 +136,11 @@ private function initPhpApi() self::$ffi = FFI::cdef($code, $phpDll); } else { $code = str_replace('ZEND_FASTCALL', '__attribute__((fastcall))', $code); - self::$ffi = FFI::cdef($code); + if(defined('PHP_DLL_FILE_PATH')) { + self::$ffi = FFI::cdef($code, PHP_DLL_FILE_PATH); + } else { + self::$ffi = FFI::cdef($code); + } } $this->setZendffi();