diff --git a/ext/ruby_prof/rp_method.c b/ext/ruby_prof/rp_method.c index 7464c764..261d59d9 100644 --- a/ext/ruby_prof/rp_method.c +++ b/ext/ruby_prof/rp_method.c @@ -6,6 +6,16 @@ #include "rp_method.h" #include "rp_profile.h" +#include + +// Needed for Ruby 3.0.* and 3.1.* +#if RUBY_API_VERSION_MAJOR == 3 && RUBY_API_VERSION_MINOR < 2 + VALUE rb_class_attached_object(VALUE klass) + { + return rb_iv_get(klass, "__attached__"); + } +#endif + VALUE cRpMethodInfo; /* ================ Helper Functions =================*/