scm_init_funcs_->push_back (f);
}
-SCM
-ly_init_ly_module (void *)
+void
+ly_init_ly_module ()
{
// Start up type system first.
Scm_init::init ();
}
scm_primitive_load_path (scm_from_ascii_string ("lily.scm"));
- return SCM_UNDEFINED;
}
void
ly_c_init_guile ()
{
Guile_user::module.import ();
- Lily::module.boot ();
- scm_c_call_with_current_module (Lily::module, ly_init_ly_module, 0);
+ Lily::module.boot (ly_init_ly_module);
Syntax::module.import ();
Display::module.import ();
scm_c_use_module ("lily");
Variable_record *variables_;
static void boot_init (void *);
public:
- void boot ();
+ void boot (void (*init)() = 0);
void import ();
void register_variable (const char *name, Scm_variable *var);
self->variables_ = 0;
}
+static SCM
+call_trampoline (void *self)
+{
+ // One more indirection since void * can only be safely cast to
+ // pointers to data rather than pointers to function.
+ (*static_cast <void (**)()> (self)) ();
+ return SCM_UNDEFINED;
+}
+
void
-Scm_module::boot ()
+Scm_module::boot (void (*init) ())
{
assert (SCM_UNBNDP (module_));
module_ = scm_c_define_module (name_, boot_init, static_cast <void *> (this));
+ // Can't wrap the following in the scm_c_define_module call since
+ // the init code may need module_ operative.
+ if (init)
+ scm_c_call_with_current_module (module_, call_trampoline, static_cast <void *> (&init));
}
void