[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Creating Modules within C
From: |
Ludovic Courtès |
Subject: |
Re: Creating Modules within C |
Date: |
Fri, 17 Nov 2006 12:34:01 +0100 |
User-agent: |
Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) |
Hi,
Volkan YAZICI <address@hidden> writes:
> Within scm_eval(), I need to use a very simple module:
>
> (define-module ultra-complex-thingy #:pure)
>
> (Yeah, that's the complete source code of my module.) The problem is,
> how can I create and use that module within my C code, in scm_eval()?
> Any assistance will be really appreciated.
You could write a piece of Scheme to create the relevant module.
Namely, you could start with something like this:
(let ((m (make-module)))
(module-use-interfaces! m
(module-public-interface the-root-module)))
And then bind that to some variable accessible from C (or pass it to a
Scheme procedure written in C that will just store it in a C variable
that you can later access).
Most of the module system is written in Scheme, which is why using it
from C is not always convenient. Also, large parts are undocumented but
one should try as much as possible to avoid using them in order to be
"future-proof".
Thanks,
Ludovic.