Ruby: dmyenc.c Source File

Ruby 3.4.4p34 (2025-05-14 revision a38531fd3f617bf734ef7d6c595325f69985ea1d)

dmyenc.c
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}