chicken-users
[Top][All Lists]
Advanced

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

Re: Personal library


From: felix . winkelmann
Subject: Re: Personal library
Date: Sun, 20 Nov 2022 00:09:41 +0100

> Over time I have amassed a small collection of useful (to me)
> procedures.  I have a folder, containing several files each of which
> defines a library (equivalent to a module in chicken, I think).  I set
> the environment variable CHEZSCHEMELIBDIRS to point at this folder and
> then I can do things like (import (maths)) to import my "maths"
> library.
>
> What would the equivalent setup for chicken be?  I have had a scan
> through the manual, but nothing is standing out to me.  I am hoping it
> is less complicated than writing my own personal eggs (but maybe not
> and maybe this is not so complicated?)

Eggs are just a method of packaging compiled modules. To have your
personal set of loadable libraries, you don't need to go through
all of that, just compile each source file for a module into a
shared loadable binary (.so), like this:

csc -s lib1.scm -J
csc -s lib1.import.scm # assuming lib1.scm defines a module named "lib1"

OLD=$(csi -p '(begin (import (chicken platform)) (car (repository-path)))')

export CHICKEN_REPOSITORY_PATH=<your-lib-dir>:$OLD

Now, when you run "csi" or "csc" imports will search your libraries
before trying to resolve built-in or installed extension modules.

Should there be any problems, don't hesitate to ask for help.


cheers
felix




reply via email to

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