dev-serveez
[Top][All Lists]
Advanced

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

[dev-serveez] guile modules


From: stefan
Subject: [dev-serveez] guile modules
Date: Sat, 1 Jun 2002 12:49:27 +0200 (CEST)

Hello list,

the serveezopt package contains a futile attempt to provide the serveez
core API through Guile.  This is mainly done via SWIG.  I added some more
functionality to put it into a guile module.

=========================================================================
(define-module (serveez)
  :no-backtrace)

(define svz:handle '())

(define (svz:init)
  (catch 'misc-error
         (lambda ()
           (if (not (feature? 'serveez))
               (begin
                 (println "Loading the Module.")
                 (set! svz:handle (dynamic-link "./.libs/libsvzguile.so"))
                 (dynamic-call "scm_init_serveez" svz:handle)
                 (svz-boot))
               (println "Module already registered.")))
         (lambda args #f))
  (println (if (and (dynamic-object? svz:handle) (feature? 'serveez)) 
               "Module successfully loaded." "Module not found.")))

(define (svz:halt)
  (println "Finalizing the Module.")
  (if (dynamic-object? svz:handle)
      (begin (svz-halt)
             (dynamic-unlink svz:handle)
             (set! svz:handle '()))))
=========================================================================

After done this we do have the procedure defined in 'libsvzguile.so' in
the namespace of the module.  In order to get exported one needs to:

(export svz:init svz:interface:list [...])

Is it possible to traverse all the procedures/variables and export them
without mentioning them explicitely?

Thanks in advance,
        address@hidden




reply via email to

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