guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Creating modules from C (was: On the deprecated auto-loading of compiled


From: Matthias Koeppe
Subject: Creating modules from C (was: On the deprecated auto-loading of compiled-code modules)
Date: 09 May 2001 13:07:03 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.6

Marius Vollmer <address@hidden> writes:

> Matthias Koeppe <address@hidden> writes:
> 
> > I embed Guile statically into a program.  Currently I am using
> > scm_register_module_xxx to register modules implemented in C with
> > Guile, before starting the interpreter.  
>
> - 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?

-- 
Matthias Köppe -- http://www.math.uni-magdeburg.de/~mkoeppe



reply via email to

[Prev in Thread] Current Thread [Next in Thread]