- String s = "*anonymous-ly-" + to_string (module_count++) + "*";
- SCM mod = scm_c_define_module (s.to_str0(), ly_init_anonymous_module, 0);
- return mod;
-}
-
-#define FUNC_NAME __FUNCTION__
+ SCM mod = SCM_EOL;
+ if (!safe)
+ {
+ /* Look up (evaluate) Scheme make-module function and call it */
+
+ SCM maker = ly_lily_module_constant ("make-module");
+ mod = scm_call_0 (maker);
+ /*
+ Look up and call Guile module-export-all! or, when using
+ Guile V1.8, the compatible shim defined in lily.scm.
+ */
+ SCM module_export_all_x = ly_lily_module_constant ("module-export-all!");
+ scm_call_1 (module_export_all_x, mod);
+
+ /*
+ Evaluate Guile module "the-root-module",
+ and ensure we inherit definitions from it and the "lily" module
+ N.B. this used to be "the-scm-module" and is deprecated in
+ Guile V1.9/2.0
+ */
+ SCM scm_module = ly_lily_module_constant ("the-root-module");
+ ly_use_module (mod, scm_module);
+ ly_use_module (mod, global_lily_module);
+ }
+ else
+ {
+ /* Evaluate and call make-safe-lilypond-module */
+ SCM proc = ly_lily_module_constant ("make-safe-lilypond-module");
+ mod = scm_call_0 (proc);
+ }