guile-user
[Top][All Lists]
Advanced

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

Re: problem with module system in guile 1.6.x and post versions


From: Marius Vollmer
Subject: Re: problem with module system in guile 1.6.x and post versions
Date: 31 May 2003 18:45:53 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

stefan <address@hidden> writes:

>  1. I have some symbols exported via scm_c_define_gsubr().  These I can
>     use at top level, e.g. (serveez-version).

The definitions created with scm_c_define_gsubr are inserted into the
'current module'.  You should therefore make sure that the right
module is the current one when you call scm_c_define_gsubr, for
example by using scm_c_define_module or
scm_c_call_with_current_module.

Your current code will likely add the new binding to the
'(guile-user)' module because that module is the current one by
default.  In Guile 1.4, the core module '(guile)' was the default
current module.  '(guile)' is automatically used by all other modules
so you binding was automatically visible everywhere.


I recommend to make a new module that contains all the c level serveez
functions:

  void
  serveez_init_module_bindings (void *unused)
  {
    scm_c_define_gsubr ("serveez-version", ...);
    scm_c_define_gsubr ("bar", ...);
    ...
    scm_c_export ("serveez-version", "bar", ..., NULL);
  }

  void
  serveez_create_module ()
  {
    scm_c_define_module ("serveez builtin",
                         serveez_init_module_bindings, NULL);
  }

Then use that module where you need it:

  (define-module (test-suite)
    :use-module (serveez builtin))

  (define (test)
    ...
    (serveez-version)
    ...)

-- 
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3  331E FAF8 226A D5D4 E405




reply via email to

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