guile-devel
[Top][All Lists]
Advanced

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

Re: What replaces scm_register_module_xxx (Doc update?)


From: Marius Vollmer
Subject: Re: What replaces scm_register_module_xxx (Doc update?)
Date: 08 Aug 2002 22:26:18 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

address@hidden writes:

> If i want my users to be able to script some of my applications
> functionality there's no library i can load with 'load-extension'

You can call C functions by other means than by 'load-extension' ;)

If you want to make several modules available to your users with
functions in them that are implemented in C, you can write the thin
Scheme wrapper for each module, but instead of calling load-extension
you directly call a previously registered C function.  Like so

    void
    foo_init_inits ()
    {
      scm_c_define_gsubr ("foo-init-strings-bindings", ...);
      scm_c_define_gsubr ("foo-init-utils-bindings", ...);
    }

    ;; file: foo/strings
    (define-module (foo strings))
    (foo-init-strings-bindings)
    (export foo-1)
    (export foo-2)
    (export bar-1)

    ;; file: foo/utils
    (define-module (foo utils))
    (foo-init-utils-bindings)
    (export foo-4)
    (export foo-5)

There is the fine point of in what module foo-init-strings-bindings is
defined.  I'm not sure about that, right now...



reply via email to

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