summaryrefslogtreecommitdiffstats
path: root/ext/dl
diff options
context:
space:
mode:
authorttate <ttate@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-05-14 20:59:07 +0000
committerttate <ttate@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-05-14 20:59:07 +0000
commite92141c641a20aae4aa53cff3716c8ad8ec0647a (patch)
tree1b6f4a4d4a0d943c8520ee1b1d6c37c0d6162efa /ext/dl
parent62a1474f79a4178e49a3fa7d5261b5fa32276f9c (diff)
downloadruby-e92141c641a20aae4aa53cff3716c8ad8ec0647a.tar.gz
ruby-e92141c641a20aae4aa53cff3716c8ad8ec0647a.tar.xz
ruby-e92141c641a20aae4aa53cff3716c8ad8ec0647a.zip
Added DL::BUILD_RUBY_PLATFORM,BUILD_RUBY_VERSION.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@8458 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/dl')
-rw-r--r--ext/dl/dl.c4
-rw-r--r--ext/dl/test/test_import.rb3
2 files changed, 7 insertions, 0 deletions
diff --git a/ext/dl/dl.c b/ext/dl/dl.c
index 53e095ed5..4473e8d49 100644
--- a/ext/dl/dl.c
+++ b/ext/dl/dl.c
@@ -1,5 +1,6 @@
#include <ruby.h>
#include <rubyio.h>
+#include <version.h>
#include <ctype.h>
#include "dl.h"
@@ -139,7 +140,10 @@ Init_dl()
rb_define_module_function(rb_mDL, "malloc", rb_dl_malloc, 1);
rb_define_module_function(rb_mDL, "realloc", rb_dl_realloc, 2);
rb_define_module_function(rb_mDL, "free", rb_dl_free, 1);
+
rb_define_const(rb_mDL, "RUBY_FREE", PTR2NUM(ruby_xfree));
+ rb_define_const(rb_mDL, "BUILD_RUBY_PLATFORM", rb_str_new2(RUBY_PLATFORM));
+ rb_define_const(rb_mDL, "BUILD_RUBY_VERSION", rb_str_new2(RUBY_VERSION));
Init_dlhandle();
Init_dlcfunc();
diff --git a/ext/dl/test/test_import.rb b/ext/dl/test/test_import.rb
index 5b5c9b07f..6df7b9cff 100644
--- a/ext/dl/test/test_import.rb
+++ b/ext/dl/test/test_import.rb
@@ -59,6 +59,9 @@ module DL
end
def test_io()
+ if( RUBY_PLATFORM != DL::BUILD_RUBY_PLATFORM )
+ return
+ end
io_in,io_out = IO.pipe()
LIBC.fprintf(io_out, "hello")
io_out.flush()