From 3df16924b45adfd88c20ef5fe25b10a1acb82dd7 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Fri, 18 Feb 2022 10:59:45 -0500 Subject: [Feature #18249] Implement ABI checking Header file include/ruby/internal/abi.h contains RUBY_ABI_VERSION which is the ABI version. This value should be bumped whenever an ABI incompatible change is introduced. When loading dynamic libraries, Ruby will compare its own `ruby_abi_version` and the `ruby_abi_version` of the loaded library. If these two values don't match it will raise a `LoadError`. This feature can also be turned off by setting the environment variable `RUBY_RUBY_ABI_CHECK=0`. This feature will prevent cases where previously installed native gems fail in unexpected ways due to incompatibility of changes in header files. This will force the developer to recompile their gems to use the same header files as the built Ruby. In Ruby, the ABI version is exposed through `RbConfig::CONFIG["ruby_abi_version"]`. --- include/ruby/ruby.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/ruby/ruby.h') diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h index f35d13685c..108127a93c 100644 --- a/include/ruby/ruby.h +++ b/include/ruby/ruby.h @@ -23,6 +23,7 @@ #include #include "defines.h" +#include "ruby/internal/abi.h" #include "ruby/internal/anyargs.h" #include "ruby/internal/arithmetic.h" #include "ruby/internal/core.h" -- cgit v1.2.3