8000 fix: GType wrong size on windows · libvips/ruby-vips@12af307 · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 12af307

Browse files
fix: GType wrong size on windows
1 parent 3a3086c commit 12af307

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