[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Creating modules from C (was: On the deprecated auto-loading of comp
From: |
Martin Grabmueller |
Subject: |
Re: Creating modules from C (was: On the deprecated auto-loading of compiled-code modules) |
Date: |
Wed, 09 May 2001 15:59:16 +0200 |
> From: Matthias Koeppe <address@hidden>
> Date: 09 May 2001 13:07:03 +0200
>
> Marius Vollmer <address@hidden> writes:
>
> > - Explicitely create and select your module in the initialization routine
> >
> > In C:
> >
> > SCM_SYMBOL (sym_my, "my");
> > SCM_SYMBOL (sym_modules, "modules");
> >
> > init_module_bindings ()
> > {
> > SCM my_module = scm_make_module (SCM_LIST2 (sym_my, sym_module));
> > /* If you want to have Scheme code in the module as well: */
> > scm_ensure_user_module (my_module);
> >
> > SCM old = scm_set_current_module (my_module);
> >
> [ definitions go here ]
> >
> > scm_set_current_module (old);
> > }
> >
> > There would be no Scheme file.
>
> I have now tried to create a pure object-code module from C, so I
> followed the approach above but left out the scm_ensure_user_module
> part. The definitions made via gh_new_procedure et al. don't seem to
> get exported reliably. In fact, when I initialize a sequence of
> modules like this, only the first one's bindings seem to get
> exported. When using the other modules, Guile reports "No code for
> module...", and in fact, the bindings are all missing.
>
> Am I missing something?
After improving my module system wisdom a bit over the last week, I'll
try my luck.
When you make a module with scm_make_module() and set that as the
current module, you simply create a new namespace into which the
definitions are put, but none of the bindings will be added to the set
of exported bindings. So, as I understand it, there should be no
exported bindings available at all. [and I'm quite surprised that you
say some definitions _are_ exported]
The exported items of a module are kept in the module's ``public
interface'', which is a kind of special-purpose-module associated with
the module. So it is necessary to create that interface. That is
what scm_ensure_user_module() does.
Also necessary is that the bindings to be created are added to the
interface, and this is what I have not yet figured out.
Can anybody else please jump in and help me out???
I will try to play around with that and post a working example, if I
succeed.
HTH so far,
'martin
- Re: On the deprecated auto-loading of compiled-code modules, Marius Vollmer, 2001/05/01
- Creating modules from C (was: On the deprecated auto-loading of compiled-code modules), Matthias Koeppe, 2001/05/09
- Re: Creating modules from C (was: On the deprecated auto-loading of compiled-code modules),
Martin Grabmueller <=
- Re: Creating modules from C (was: On the deprecated auto-loading of compiled-code modules), Martin Grabmueller, 2001/05/09
- Re: Creating modules from C (was: On the deprecated auto-loading of compiled-code modules), thi, 2001/05/09
- Re: Creating modules from C (was: On the deprecated auto-loading of compiled-code modules), Matthias Koeppe, 2001/05/14
- Re: Creating modules from C, Marius Vollmer, 2001/05/14
- Re: Creating modules from C, Rob Browning, 2001/05/14
- Re: Creating modules from C, Marius Vollmer, 2001/05/14
- Re: Creating modules from C, Dirk Herrmann, 2001/05/14
- Re: Creating modules from C, Alex Shinn, 2001/05/14
- Re: Creating modules from C, Marius Vollmer, 2001/05/14
- Re: Creating modules from C, Lars J. Aas, 2001/05/15