[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Creating modules from C
From: |
Alex Shinn |
Subject: |
Re: Creating modules from C |
Date: |
14 May 2001 11:12:52 -0400 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.0.100 |
>>>>> "Marius" == Marius Vollmer <address@hidden> writes:
Marius> Ok. It's "Drastic Measures Time". [Thinking as I
Marius> type...] People should be able to handle modules from C,
Marius> in a way mostly similar to how they do it from Scheme.
[...]
Marius> The higher level interface to the module system consists
Marius> of
Marius> - define-module MOD-NAME
Marius> - use-modules MOD-NAME...
Marius> - export NAME...
Marius> - the concept of the `current module'
So how would one define an exported function from C? Something like
SCM module = scm_c_define_module("my-module", my_module_init);
SCM s_foo = scm_make_gsubr("foo", 0, 0, 0, foo);
scm_c_module_define(module, "foo", s_foo);
scm_c_export("foo", NULL);
Is this right? This requires either three steps for each function or
two steps plus keeping a list of the functions and exporting them
once.
IMHO, for things like SWIG and modules that define a large number of
exported functions (e.g. I'm working on SDL bindings), the cleanest
interface would be to have something like define-public available from
C. Maybe
scm_c_define_public(module, "foo", 0, 0, 0, foo);
That way you have one place where your function is made available, and
you don't have to keep function lists synced up in your .c/.scm files.
--
Alex Shinn <address@hidden>
Lisper, Smalltalker, and all around poor speaker
- Re: On the deprecated auto-loading of compiled-code modules, (continued)
- 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, 2001/05/09
- 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 <=
- Re: Creating modules from C, Marius Vollmer, 2001/05/14
- Re: Creating modules from C, Lars J. Aas, 2001/05/15
- Re: Creating modules from C, Marius Vollmer, 2001/05/15
- Re: Creating modules from C, Dirk Herrmann, 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, Marius Vollmer, 2001/05/14
- Re: Creating modules from C, Dirk Herrmann, 2001/05/14
- Re: Creating modules from C, Martin Grabmueller, 2001/05/14
- Re: Creating modules from C, Marius Vollmer, 2001/05/14