Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 01c7e16

Browse files
committedFeb 21, 2024
Separate miniruby from dmyext.c
1 parent 04729fe commit 01c7e16

File tree

4 files changed

+34
-10
lines changed

4 files changed

+34
-10
lines changed
 

‎common.mk

+2-2
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ NORMALMAINOBJ = main.$(OBJEXT)
7878
MAINOBJ = $(NORMALMAINOBJ)
7979
DLDOBJS = $(INITOBJS)
8080
EXTSOLIBS =
81-
MINIOBJS = $(ARCHMINIOBJS) miniinit.$(OBJEXT) dmyext.$(OBJEXT)
81+
MINIOBJS = $(ARCHMINIOBJS) miniinit.$(OBJEXT)
8282
ENC_MK = enc.mk
8383
MAKE_ENC = -f $(ENC_MK) V="$(V)" UNICODE_HDR_DIR="$(UNICODE_HDR_DIR)" \
8484
RUBY="$(BOOTSTRAPRUBY)" MINIRUBY="$(BOOTSTRAPRUBY)" $(mflags)
@@ -412,7 +412,7 @@ programs: $(PROGRAM) $(WPROGRAM) $(arch)-fake.rb
412412

413413
$(PREP): $(MKFILES)
414414

415-
miniruby$(EXEEXT): config.status $(ALLOBJS) $(ARCHFILE)
415+
miniruby$(EXEEXT): config.status $(NORMALMAINOBJ) $(MINIOBJS) $(COMMONOBJS) $(ARCHFILE)
416416

417417
objs: $(ALLOBJS)
418418

‎dmyenc.c

+13-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
1-
// This file is used only by ruby.
2-
// miniruby does not use this Init_enc. Instead, "miniinit.c" provides Init_enc, which defines only the builtin encodings.
3-
// Dynamically-linked ruby uses this Init_enc, which requires "enc/encdb.so" to load the builtin encodings and set up the optional encodings.
4-
// Statically-linked ruby does not use this Init_enc. Instead, "enc/encinit.c" (which is a generated file) defines Init_enc, which activates the encodings.
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.
514

615
#define require(name) ruby_require_internal(name, (unsigned int)sizeof(name)-1)
716
int ruby_require_internal(const char *, int);

‎dmyext.c

+13-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
1-
// This file is used by dynamically-linked ruby and miniruby.
2-
// miniruby uses this Init_ext, which does nothing. It does not support require'ing extension libraries.
3-
// Dynamically-linked ruby uses this Init_ext, which does nothing. It loads extension libraries by dlopen, etc.
4-
// Statically-linked ruby does not use this Init_ext. Instead, "ext/extinit.c" (which is a generated file) defines Init_ext, which activates the (statically-linked) extension libraries.
1+
// This file is used by dynamically-linked ruby, which has no
2+
// statically-linked extension libraries.
3+
//
4+
// - miniruby does not use this Init_ext. Instead, "miniinit.c"
5+
// provides Init_enc, which does nothing too. It does not support
6+
// require'ing extension libraries.
7+
//
8+
// - Dynamically-linked ruby uses this Init_ext, which does
9+
// nothing. It loads extension libraries by dlopen, etc.
10+
//
11+
// - Statically-linked ruby does not use this Init_ext. Instead,
12+
// "ext/extinit.c" (which is a generated file) defines Init_ext,
13+
// which activates the (statically-linked) extension libraries.
514

615
void
716
Init_ext(void)

‎miniinit.c

+6
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ Init_enc(void)
4848
rb_encdb_alias("ASCII", "US-ASCII");
4949
}
5050

51+
/* miniruby does not support dynamic loading. */
52+
void
53+
Init_ext(void)
54+
{
55+
}
56+
5157
#include "mini_builtin.c"
5258

5359
void

0 commit comments

Comments
 (0)
Please sign in to comment.