diff options
author | Sutou Kouhei <kou@clear-code.com> | 2021-07-05 10:45:48 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2021-07-13 19:37:46 +0900 |
commit | bb868f4814c09c978f20f224c5e99656bc8b9bee (patch) | |
tree | 0bfeb0e7494510d244c8cf21b830d69059d13f6c /ext/fiddle/fiddle.h | |
parent | 5c0d8c6369f92915bf99924f58f0763abe4f493e (diff) | |
download | ruby-bb868f4814c09c978f20f224c5e99656bc8b9bee.tar.gz |
[ruby/fiddle] Use have_header and have_type to detect memory view availability
Fix https://github.com/ruby/fiddle/pull/84
It may detect ruby/memory_view.h for system Ruby that is installed in
/usr.
We can use RUBY_API_VERSION_MAJOR to detect memory view availability
because memory view is available since Ruby 3.0.
Reported by Jun Aruga. Thanks!!!
https://github.com/ruby/fiddle/commit/3292929830
Diffstat (limited to 'ext/fiddle/fiddle.h')
-rw-r--r-- | ext/fiddle/fiddle.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/ext/fiddle/fiddle.h b/ext/fiddle/fiddle.h index dbad910d07..c5d7fa8016 100644 --- a/ext/fiddle/fiddle.h +++ b/ext/fiddle/fiddle.h @@ -2,6 +2,7 @@ #define FIDDLE_H #include <ruby.h> +#include <ruby/version.h> #include <errno.h> #if defined(_WIN32) @@ -189,7 +190,7 @@ #define ALIGN_INT32_T ALIGN_OF(int32_t) #define ALIGN_INT64_T ALIGN_OF(int64_t) -#ifdef HAVE_TYPE_RB_MEMORY_VIEW_T +#if RUBY_API_VERSION_MAJOR >= 3 # define FIDDLE_MEMORY_VIEW #endif |