Skip to content

Commit

Permalink
improve ffi startup again
Browse files Browse the repository at this point in the history
thanks West14

see #183
  • Loading branch information
jcupitt committed Jan 24, 2023
1 parent cfe001c commit c0d4140
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 13 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ All notable changes to `:vips` will be documented in this file.

## master

- fix startup on windows [West14]
- improve FFI startup [West14]

## 2.1.1 - 2022-11-13

Expand Down
2 changes: 1 addition & 1 deletion examples/composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"require": {
"jcupitt/vips": "2.0.0"
"jcupitt/vips": "2.1.1"
}
}
17 changes: 6 additions & 11 deletions src/FFI.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,17 +201,12 @@ private static function init(): void
return;
}

// try experimentally binding a bit of stdio ... if this fails, FFI
// has probably not been installed or enabled, and php will throw a
// useful error message
//
// this won't work on windows since there's no run time linker
//
// FIXME ... find a better way to test if FFI has been enabled
if (PHP_OS_FAMILY !== "Windows") {
$stdio = \FFI::cdef(<<<EOS
int printf(const char *, ...);
EOS);
// the two usual install problems
if (!extension_loaded('ffi')) {
throw new Exception('FFI extension not loaded');
}
if (!ini_get('ffi.enable')) {
throw new Exception("ffi.enable not set to 'true'");
}

$vips_libname = self::libraryName("libvips", 42);
Expand Down

0 comments on commit c0d4140

Please sign in to comment.