[Top][All Lists]

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

Re: Adjusting Load Path from C/C++?

From: Mike Gran
Subject: Re: Adjusting Load Path from C/C++?
Date: Wed, 15 Apr 2020 22:25:12 -0700

On Wed, Apr 15, 2020 at 04:08:08AM +0000, Jaft wrote:
> Hello.  I'm attempting to use Guile, from C, in a project. I've
> managed, I believe, to properly hook up the dependencies and can
> #include but running scm_init_guile() results in the error

>  Throw without catch before boot:
> Throw to key misc-error with args ("primitive-load-path" "Unable to find file 
> ~S in load path" ("ice-9/boot-9") #f)Aborting.

You definitely need to be able to find ice-9/boot-9 at the very beginning
of booting up guile.  You won't have access to any Guile functionality
if it can't find it.  This means that you can't use Guile procedures
to set the load path, since it needs the load path set to have Guile

> Definitely someone correct me if I'm mistaken but I'm guessing it's
> occurring because it's not finding the .scm files that typically (I
> think? Leastwise, where I've always seen them) reside in a "share"
> directory somewhere on the root path tree?

> So this project allows moving libraries into where it's deployed but
> all other files are containerized in the app's designated directory.

> I believe there's a way to set the load path on build of Guile
> (though, now that I think about it, the project may not share what
> the eventual app. directory is/will-be during the build process so
> that may not even be feasible???) but I was wondering if there was a
> way to set (or add to) the build path from C?

> I was thinking something like add-to-load-path but I didn't see a
> corresponding C function in the documentation.

If you know where you want to install your guile files, it is better to
set the proper paths using options like "--prefix" when running
"configure" for Guile.

When it comes to setting the search paths from C, the easiest, if
you don't have a problem with it, is to call setenv to set
environment variables such as GUILE_LOAD_PATH and GUILE_LOAD_COMPILED_PATH
before your first call to scm_init_guile or scm_boot_guile.

> If I had a way, I figured I could just, then, have the necessary
> modules moved to the app.'s directory on build, add the current
> directory to the load path, and then call scm_init_guile().

> I dunno if there is a solve but thanks to anyone for any help!
> Jonathan

reply via email to

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