Trying to fix a linker issue

This commit is contained in:
Matthias Koefferlein 2025-05-25 19:01:04 +02:00
parent 4a20a30888
commit fb16c8c6f6
2 changed files with 11 additions and 17 deletions

View File

@ -32,10 +32,6 @@
# include <ruby/debug.h>
#endif
#if HAVE_RUBY_VERSION_CODE < 20200
# include <ruby/encoding.h>
#endif
static VALUE ruby_top_self = Qnil;
VALUE rb_get_top_self ()
@ -192,18 +188,6 @@ rba_check_error (int state)
}
}
#if HAVE_RUBY_VERSION_CODE < 20200
// Ruby <2.2 does not have this useful function
VALUE rb_utf8_str_new (const char *ptr, long len)
{
VALUE str = rb_str_new (ptr, len);
rb_enc_associate_index (str, rb_utf8_encindex ());
return str;
}
#endif
/**
* @brief needed because StringValue is a macro:
*/

View File

@ -136,7 +136,17 @@ inline void rb_hash_clear(VALUE hash)
#endif
#if HAVE_RUBY_VERSION_CODE < 20200
VALUE rb_utf8_str_new (const char *str, long len);
#include <ruby/encoding.h>
// Ruby <2.2 does not have this useful function
inline VALUE rb_utf8_str_new (const char *ptr, long len)
{
VALUE str = rb_str_new (ptr, len);
rb_enc_associate_index (str, rb_utf8_encindex ());
return str;
}
#endif
typedef VALUE (*ruby_func)(ANYARGS);