PHP FFI oddity
| From: | Larry Garfield | Date: | Thu, 02 Jan 2020 21:38:18 +0000 |
| Subject: | PHP FFI oddity | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-326975@lists.php.net to get a copy of this message | ||
This is a long shot, but I figured I'd try here before PHP-Internals.
I'm experimenting with PHP-FFI. 2 weeks ago, I had working code. The same code 2 weeks later
is now not working. (I say "Same code" because I can confirm that via Git. It's not
just me saying I didn't touch it.)
The code in question is here:
https://github.com/Crell/ffi-test/tree/master/points
Running
make inline (to test loading up the FFI logic inline) works.
Running make preload (to load the library in a preload routine) fails.
Specifically, the preloader.php script is called, and gives this error:
PHP Warning: failed pre-loading '/home/crell/temp/php-ffi-test/points/points.h', cannot
resolve C function 'distance' in preloader.php on line 6
Line 6 is:
FFI::load(__DIR__ . "/points.h");
I do not understand how this worked before, but doesn't now. A friend suggested some library
version or path changed, but I've no idea what.
The "dummy" example (in a separate folder) works fine. It's straight out of the PHP
manual. The main difference is it's linking against stdlib, whereas points has a
tiny custom library. That's being problematic.
Anyone have a recommendation here? I'm out of ideas.
--
Larry Garfield
larry@garfieldtech.com