@@ -42,7 +42,19 @@ class << self
42
42
43
43
extend FFI ::Library
44
44
45
- ffi_lib library_name ( "glib-2.0" , 0 )
45
+ if FFI ::Platform . windows?
46
+ # On Windows, `GetProcAddress()` can only search in a specified DLL and
47
+ # doesn't look into its dependent libraries for symbols. Therefore, we
48
+ # check if the GLib DLLs are available. If these can not be found, we
49
+ # assume that GLib is statically linked into libvips.
50
+ ffi_lib [ "libglib-2.0-0.dll" , "libvips-42.dll" ]
51
+ else
52
+ # macOS and *nix uses `dlsym()`, which also searches for named symbols
53
+ # in the dependencies of the shared library. Therefore, we can support
54
+ # a single shared libvips library with all dependencies statically
55
+ # linked.
56
+ ffi_lib library_name ( "vips" , 42 )
57
+ end
46
58
47
59
attach_function :g_malloc , [ :size_t ] , :pointer
48
60
@@ -134,7 +146,11 @@ def self.set_log_domain domain
134
146
module GObject
135
147
extend FFI ::Library
136
148
137
- ffi_lib library_name ( "gobject-2.0" , 0 )
149
+ if FFI ::Platform . windows?
150
+ ffi_lib [ "libgobject-2.0-0.dll" , "libvips-42.dll" ]
151
+ else
152
+ ffi_lib library_name ( "vips" , 42 )
153
+ end
138
154
139
155
# we can't just use ulong, windows has different int sizing rules
140
156
if FFI ::Platform ::ADDRESS_SIZE == 64
0 commit comments