[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [dev-serveez] guile modules
From: |
stefan |
Subject: |
Re: [dev-serveez] guile modules |
Date: |
Fri, 7 Jun 2002 18:35:14 +0200 (CEST) |
On 6 Jun 2002, Thien-Thi Nguyen wrote:
> this approach looks generally useful. it seems each application that uses
> guile (including guile) has similar "private module loading" needs. the
> experimental guile-1.4.2 ice-9/boot-9.scm fragment below could be used to
> implement svz:init (w/ some tweaks).
>
> thi
>
>
> _______________________________________________________
> ;;; {internal modules} (experimental)
> ;;;
>
> (define (call-with-ltdl-prefix prefix thunk)
> (let ((cur (or (ltdl-get-search-path) "")))
> (ltdl-set-search-path!
> (with-output-to-string
> (lambda ()
> (let loop ((ls (cond ((list? prefix) prefix)
> ((string? prefix) (list prefix))
> (else '()))))
> (or (null? ls)
> (begin
> (display (car ls))
> (display #\:) ; a friendly character
> (loop (cdr ls)))))
> (display cur))))
> (thunk)
> (ltdl-set-search-path! cur)))
>
> (define (guile-internal-modules-dir)
> (apply format #f
> (let ((iref (lambda (key) (assq-ref %guile-build-info key))))
> ;; check for invocation via pre-inst-guile
> (if (and (getenv "GUILE")
> (getenv "GUILE_LOAD_PATH")
> (getenv "LTDL_LIBRARY_PATH")
> (string=? (car %load-path) (iref 'top_srcdir)))
> `("~A/libguile/.libs" ,(iref 'top_builddir))
> `("~A/~A/modules" ,(iref 'pkglibdir) ,(iref 'guileversion))))))
>
> (define (load-guile-internal-module name)
> (call-with-ltdl-prefix
> (guile-internal-modules-dir)
> (lambda ()
> (format #t "(ltdl-get-search-path) => ~A\n" (ltdl-get-search-path))
> (let* ((init (format #f "scm_init_~A" name))
> (sofile (format #f "lib~A" name))
> (dobj (dynamic-link sofile)))
> (format #t "sofile => ~A\ndobj => ~A\n" sofile dobj)
> (dynamic-call init dobj)))))
This looks also useful. But it does not help about the (export ...)
issue. I had a look at `ice-9/boot.scm' but could not find a good
starting point... There is sooooo much about modules in it. Any hint?
Thanks,
address@hidden