[Top][All Lists]

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

Re: How to correctly load modules from runtime defineable locations?

From: Михаил Бахтерев
Subject: Re: How to correctly load modules from runtime defineable locations?
Date: Fri, 6 Mar 2020 21:29:10 +0500

Thanks for the detailed answer.

When i run

  guile -L lib bin/check.scm

everything works fine. No warnings.

But my problem is that client wants just to unpack code archive to the
random location and run it from there. Unfortunately, no GUIX, no custom
builds. I don't understand what is the difference between -L option and
add-to-load-path. It seems, that -L just adds lib directory to the
%load-path, and that is it.

May be it would be better to provide shell script, but i would like
to solve this in pure Guile, if possible. May be, instead of
adding-to-load-path, the better solution would be to reexecute Guile
with appropriate -L options from simple trampoline .scm script?

If i opt to this solution of reexecuting Guile, are there better and
more robust choices than passing options through command line? Could the
passing paths through environment variables be more reliable option?

On Fri, Mar 06, 2020 at 12:53:37PM +0100, Zelphir Kaltstahl wrote:
> Hi!
> I am not sure this will help you, but here is what I observed and what
> works best for me:
>   * For running Guile programs use: `guile -L <root dir of project>
>     <path to scm file>`.
>   * For using libraries:
>       o If Guile is installed via GUIX, try to install the library
>         through GUIX as well, then it should be available for Guile.
>       o If Guile is installed via GUIX, but the library is not on GUIX
>         or not in the version you would like, create a directory
>         somewhere and set the Guile load path for that directory.
>       o If Guile is built and installed by yourself also use Guile load
>         path.
>   * Modules need to be named the same as the directories they are in to
>     be found:
>       o To use (use-modules (some mymodule)) the module should be in a
>         directory `some` and a file `mymodule.scm`.
>       o To use (use-modules (some)), the module should be in a file
>         named `some.scm`.
> Perhaps the Guile load path varies on different systems?
> Regards,
> Zelphir

reply via email to

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