about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2011-02-27 09:59:11 +0000
committerEric Wong <normalperson@yhbt.net>2011-02-27 11:02:45 +0000
commit6d336b465a9ff86b933949ebc7a58aeb717bda36 (patch)
treec053aa5e07df7847d495af459327acf3d0b90767
parent6d22887be14c6f543d86425545e79eff92d97714 (diff)
downloadruby_posix_mq-6d336b465a9ff86b933949ebc7a58aeb717bda36.tar.gz
It's only available when compiled with libffi.
-rw-r--r--test/test_posix_mq.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/test/test_posix_mq.rb b/test/test_posix_mq.rb
index 97b6337..fe65f8c 100644
--- a/test/test_posix_mq.rb
+++ b/test/test_posix_mq.rb
@@ -5,6 +5,10 @@ require 'thread'
 require 'fcntl'
 $stderr.sync = $stdout.sync = true
 require "dl"
+begin
+  require "dl/func"
+rescue LoadError
+end
 
 class Test_POSIX_MQ < Test::Unit::TestCase
 
@@ -102,9 +106,10 @@ class Test_POSIX_MQ < Test::Unit::TestCase
     libcs = %w(libc.so.6 /usr/lib/libc.sl)
     libcs.each do |name|
       libc = DL::Handle.new(name) rescue next
-      if defined?(Fiddle)
+      if defined?(DL::Function)
         alarm = libc["alarm"]
-        alarm = Fiddle::Function.new(alarm, [DL::TYPE_INT], DL::TYPE_INT)
+        alarm = DL::CFunc.new(alarm, DL::TYPE_INT, "alarm")
+        alarm = DL::Function.new(alarm, [DL::TYPE_INT], DL::TYPE_INT)
       else
         alarm = libc["alarm", "II"]
       end