guile-user
[Top][All Lists]
Advanced

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

Re: c interface to modules


From: Rob Browning
Subject: Re: c interface to modules
Date: Fri, 17 Jun 2005 17:44:33 -0500
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux)

Ondrej Zajicek <address@hidden> writes:

> I would like to export two sets (low-level and high-level interface)
> of C functions to Scheme. I think it is a good idea to have each
> interface in different module. What is a good way to define C
> function in specific module? Should i just replace
> scm_c_define_gsubr with combination of scm_c_make_gsubr and
> scm_c_module_define?

If you write each of your modules as a .scm file which loads a C
library and calls an init function (see 1.6's srfi-13.scm, for
example), then you can just have two init functions in your C library,
one for the low-level functions, and one for the high-level functions,
i.e.

  ;; high-level.scm
  (define-module (high-level))
  (load-extension "libguile-foo-v-1" "scm_init_foo_high_level")
  (export bar)
  ...


  ;; high-level.scm
  (define-module (low-level))
  (load-extension "libguile-foo-v-1" "scm_init_foo_low_level")
  (export baz)
  ...

-- 
Rob Browning
rlb @defaultvalue.org and @debian.org; previously @cs.utexas.edu
GPG starting 2002-11-03 = 14DD 432F AE39 534D B592  F9A0 25C8 D377 8C7E 73A4




reply via email to

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