Ruby 3.5.0dev (2025-01-10 revision 5fab31b15e32622c4b71d1d347a41937e9f9c212)
dmyenc.c (5fab31b15e32622c4b71d1d347a41937e9f9c212)
1// This file is used by dynamically-linked ruby, which has no
2// statically-linked encodings other than the builtin encodings.
3//
4// - miniruby does not use this Init_enc. Instead, "miniinit.c"
5// provides Init_enc, which defines only the builtin encodings.
6//
7// - Dynamically-linked ruby uses this Init_enc, which requires
8// "enc/encdb.so" to load the builtin encodings and set up the
9// optional encodings.
10//
11// - Statically-linked ruby does not use this Init_enc. Instead,
12// "enc/encinit.c" (which is a generated file) defines Init_enc,
13// which activates the encodings.
14
15#define require(name) ruby_require_internal(name, (unsigned int)sizeof(name)-1)
16int ruby_require_internal(const char *, int);
17
18void
19Init_enc(void)
20{
21 if (require("enc/encdb.so") == 1) {
22 require("enc/trans/transdb.so");
23 }
24}