summaryrefslogtreecommitdiff
path: root/ext/dl
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-11-25 01:31:21 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-11-25 01:31:21 +0000
commitb00dfcca177fde79630e182934f509fcdd9f3998 (patch)
treea7fe3490568df446f78fe83060c8ef519c5c9c8d /ext/dl
parent69a248a0736aba6e540670aff0cace024533cd68 (diff)
* ext/dl/callback/mkcallback.rb (gencallback): shouldn't assume that
VALUE is the same size with long. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29925 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/dl')
-rw-r--r--ext/dl/callback/mkcallback.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/ext/dl/callback/mkcallback.rb b/ext/dl/callback/mkcallback.rb
index d2f9e3f..d14072a 100644
--- a/ext/dl/callback/mkcallback.rb
+++ b/ext/dl/callback/mkcallback.rb
@@ -128,8 +128,16 @@ FUNC_#{calltype.upcase}(#{func_name(ty,argc,n,calltype)})(#{(0...argc).collect{|
{
VALUE ret, cb#{argc > 0 ? ", args[#{argc}]" : ""};
#{
+ sizeof_voidp = [""].pack('p').size
+ sizeof_long = [0].pack('l!').size
(0...argc).collect{|i|
- " args[%d] = LONG2NUM(stack%d);" % [i,i]
+ if sizeof_voidp == sizeof_long
+ " args[%d] = LONG2NUM(stack%d);" % [i,i]
+ elsif sizeof_voidp == 8 # should get sizeof_long_long...
+ " args[%d] = LL2NUM(stack%d);" % [i,i]
+ else
+ raise "unknown size of void*"
+ end
}.join("\n")
}
cb = rb_ary_entry(rb_ary_entry(#{proc_entry}, #{ty}), #{(n * DLSTACK_SIZE) + argc});