summaryrefslogtreecommitdiff
path: root/ext/-test-
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2021-07-14 15:38:55 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2021-07-14 18:55:59 +0900
commit169529a0c0973fa925ad3b36f4427d31e802a37e (patch)
tree12d70a5d6bf41b5dc781e4148d2ce9a7b6f75f4b /ext/-test-
parent818c74b7f4d5b88833af26226fc81e563b5d11b9 (diff)
[ruby/fiddle] Check HAVE_RUBY_MEMORY_VIEW_H rather than API version (https://github.com/ruby/fiddle/pull/86)
https://github.com/ruby/fiddle/commit/c5abcc3a7e
Diffstat (limited to 'ext/-test-')
-rw-r--r--ext/-test-/memory_view/extconf.rb2
-rw-r--r--ext/-test-/memory_view/memory_view.c7
2 files changed, 9 insertions, 0 deletions
diff --git a/ext/-test-/memory_view/extconf.rb b/ext/-test-/memory_view/extconf.rb
index d786b15db9..123b80b8d0 100644
--- a/ext/-test-/memory_view/extconf.rb
+++ b/ext/-test-/memory_view/extconf.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: false
+require "mkmf"
+
require_relative "../auto_ext.rb"
auto_ext(inc: true)
diff --git a/ext/-test-/memory_view/memory_view.c b/ext/-test-/memory_view/memory_view.c
index 740c52f0ef..c1df0353cf 100644
--- a/ext/-test-/memory_view/memory_view.c
+++ b/ext/-test-/memory_view/memory_view.c
@@ -1,4 +1,6 @@
#include "ruby.h"
+
+#ifdef HAVE_RUBY_MEMORY_VIEW_H
#include "ruby/memory_view.h"
#define STRUCT_ALIGNOF(T, result) do { \
@@ -373,10 +375,13 @@ mdview_aref(VALUE obj, VALUE indices_v)
return result;
}
+#endif /* HAVE_RUBY_MEMORY_VIEW_H */
+
void
Init_memory_view(void)
{
rb_ext_ractor_safe(true);
+#ifdef HAVE_RUBY_MEMORY_VIEW_H
VALUE mMemoryViewTestUtils = rb_define_module("MemoryViewTestUtils");
rb_define_module_function(mMemoryViewTestUtils, "available?", memory_view_available_p, 1);
@@ -440,4 +445,6 @@ Init_memory_view(void)
DEF_ALIGNMENT_CONST(double, DOUBLE);
#undef DEF_ALIGNMENT_CONST
+
+#endif /* HAVE_RUBY_MEMORY_VIEW_H */
}