Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
chopins committed Mar 12, 2020
1 parent 06a777e commit d370ada
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 5 additions & 1 deletion src/FFIExtend.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit d370ada

Please sign in to comment.