Automatically load Zlib again, the right way

This commit is contained in:
Zorua 2022-12-21 05:18:52 -05:00
parent a2075a5023
commit 368534fd1d

View file

@ -270,6 +270,15 @@ static void mriBindingInit() {
rb_str_freeze(vers);
rb_define_const(mod, "VERSION", vers);
// Automatically load zlib if it's present -- the correct way this time
int state;
rb_eval_string_protect("require('zlib') if !Kernel.const_defined?(:Zlib)", &state);
if (state) {
Debug() << "Could not load Zlib. If this is important, make sure Ruby was built with static extensions, or that"
<< ((MKXPZ_PLATFORM == MKXPZ_PLATFORM_MACOS) ? "zlib.bundle" : "zlib.so")
<< "is present and reachable by Ruby's loadpath.";
}
// Set $stdout and its ilk accordingly on Windows
// I regret teaching you that word
#ifdef __WIN32__