note 124677 added to ffi.load
| From: | ojrask at gmail dot com | Date: | Mon, 03 Feb 2020 19:23:44 +0000 |
| Subject: | note 124677 added to ffi.load | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-213994@lists.php.net to get a copy of this message | ||
Regarding the
FFI_LIB constant:
The path given can be either relative, or absolute, or then refer to a library that is in your
global libraries path (i.e. where libc.so.6 and friends are).
The absolute path and global lib path work as expected. The relative path does not work from the
header file path, but the current working directory instead. So when you create header files for FFI
usage, remember that the PHP script can be called anywhere and this means any relative paths in
FFI_LIB will most probably fail.
Not sure if there is some possibility to make it use paths relative to the script being called, or
relative to the header file being loaded. That would make more sense to me at least.
Right now FFI_LIB is quite unusable when it comes to making FFI-powered PHP packages
that can be installed literally anywhere on a system. FFI::cdef works just as well, but
FFI::scope also seems to rely on FFI_LIB meaning it will fail with
relative paths as well.
I guess this comes from the C function dlopen as is.
----
Server IP: 45.112.84.4
Probable Submitter: 185.85.3.195 (proxied: 87.100.226.142)
----
Manual Page -- http://php.net/manual/en/ffi.load.php
Edit -- https://master.php.net/note/edit/124677
Del: integrated -- https://master.php.net/note/delete/124677/integrated
Del: useless -- https://master.php.net/note/delete/124677/useless
Del: bad code -- https://master.php.net/note/delete/124677/bad+code
Del: spam -- https://master.php.net/note/delete/124677/spam
Del: non-english -- https://master.php.net/note/delete/124677/non-english
Del: in docs -- https://master.php.net/note/delete/124677/in+docs
Del: other reasons-- https://master.php.net/note/delete/124677
Reject -- https://master.php.net/note/reject/124677
Search -- https://master.php.net/manage/user-notes.php