guile-user
[Top][All Lists]
Advanced

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

Re: loadpath


From: Steve Tell
Subject: Re: loadpath
Date: Mon, 4 Aug 2003 22:24:46 -0400 (EDT)

On Mon, 4 Aug 2003, Andreas Schröder wrote:

> Hi!
> 
> Where can I specify the loadpath for an already compiled guile-application? 

The guile INSTALL file says:
        If you want to run Guile without installing it, set the environment
        variable `GUILE_LOAD_PATH' to a colon-separated list of directories,
        including the directory containing this INSTALL file.  If you used a
        separate build directory, you'll need to include the build directory
        in the path as well.
        ...
        You will additionally need to set your `LTDL_LIBRARY_PATH' environment
        variable to the directory in which the compiled SRFI support modules
        are created if you want to use the modules for SRFI-4, SRFI-13 or
        SRFI-14 support.  Similar to the example above, this will be,

I've you've moved guile's support files since compiling guile for some
reason, you might be able to patch things up by setting those
appropriately.

> It's asking me for the boot-9.scm in a procedure called 
> "primitive-load-path".
> Will I have to recompile and put the path in the programcode? Or I could use 
> a 
> symbolic link in the place the program looks for the library.

In the libguile-using prorams I've written in which main() is in compiled
C, I arrange for the value of a program-specific environment variable to
be appended onto %load-path before my program searches for its guile
modules.  I do this in a bit of scheme which is stored in a C string in
the compiled program.  

I've experimented with various ways of printing better error messages when
this whole startup process goes astray.  Here's what I'm using currently.
initial_scheme_string[] is a C array containing:


(define startup-error-flag #f)
(add-hook! 
 error-hook
 (lambda (a b c d e)
   (set! startup-error-flag #t)))

(let* ((genv (getenv "GWAVE_GUILE_DIR"))
       (gwave-guiledir (if genv
                           genv
                           (string-append gwave-datadir "/guile"))))
  (set! %load-path (cons gwave-guiledir %load-path)))

; Do setup and find a .gwaverc
(load-from-path "app/gwave/gwave-startup.scm")

; this next expression must be the last one, returning #t or #f, which
; becomes the return value of the call to scwm_safe_eval_str() in gwave.c
(if startup-error-flag
    (begin
      (display "gwave: Error(s) in gwave-startup.scm or other startup
files\n")
      (display "gwave: %load-path was ")(display %load-path)(newline)
      #f)
    #t)

Then the C code does somthing like this:

        SCM res = scwm_safe_eval_str(init_scheme_string);
        if(! scm_eq_p (res, SCM_BOOL_T)) {
               fprintf(stderr, "gwave: aborting due to errors.\n");
               exit(1);
        }

This prevents the application from comming up badly crippled (probably
lacking even a menu with a quit option) when it can't find any of its
guile modules.



 
> Please help!
> Andi
> 
> 
> _______________________________________________
> Guile-user mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/guile-user
> 

-- 
--
Steve Tell  address@hidden 





reply via email to

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