8000 Merge pull request #315 from danini-the-panini/ds-fix-gtype-win64 · libvips/ruby-vips@502a6c6 · GitHub
[go: up one dir, main page]

Skip to content

Commit 502a6c6

Browse files
authored
Merge pull request #315 from danini-the-panini/ds-fix-gtype-win64
fix: GType wrong size on windows
2 parents 5eb3fac + 12af307 commit 502a6c6

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

example/inheritance_with_refcount.rb

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,12 @@ def ffi_managed_struct
132132
end
133133
end
134134

135-
# :gtype will usually be 64-bit, but will be 32-bit on 32-bit Windows
136-
typedef :ulong, :GType
135+
# we can't just use ulong, windows has different int sizing rules
136+
if FFI::Platform::ADDRESS_SIZE == 64
137+
typedef :uint64, :GType
138+
else
139+
typedef :uint32, :GType
140+
end
137141
end
138142

139143
module Vips
@@ -144,7 +148,11 @@ module Vips
144148
GLib.set_log_domain(LOG_DOMAIN)
145149

146150
# need to repeat this
147-
typedef :ulong, :GType
151+
if FFI::Platform::ADDRESS_SIZE == 64
152+
typedef :uint64, :GType
153+
else
154+
typedef :uint32, :GType
155+
end
148156

149157
attach_function :vips_init, [:string], :int
150158
attach_function :vips_shutdown, [], :void

lib/vips.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,12 @@ module Vips
575575
LOG_DOMAIN = "VIPS"
576576
GLib.set_log_domain LOG_DOMAIN
577577

578-
typedef :ulong, :GType
578+
# we can't just use ulong, windows has different int sizing rules
579+
if FFI::Platform::ADDRESS_SIZE == 64
580+
typedef :uint64, :GType
581+
else
582+
typedef :uint32, :GType
583+
end
579584

580585
attach_function :vips_error_buffer, [], :string
581586
attach_function :vips_error_clear, [], :void

0 commit comments

Comments
 (0)
0