[Top][All Lists]

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

Re: [Chicken-users] Some questions about CHICKEN 5 eggs and modules

From: Thomas Chust
Subject: Re: [Chicken-users] Some questions about CHICKEN 5 eggs and modules
Date: Wed, 29 Aug 2018 12:14:35 +0200

On Tue, 28 Aug 2018 20:40:33 +0200 address@hidden wrote:

> [...]
> I'll try to address some of your questions.
> [...]


thanks for taking the time to reply :-)

> [...]
> > - Some eggs install one extension library containing several modules. The 
> > new 
> > CHICKEN module system always tries to load a library named the same as the 
> > module upon import. Is it no longer possible to separate library loading 
> > and 
> > module import? How can one consume those "compound" libraries now?
> To simplify the confusion related to "require-extension", "use", etc.
> "import" does now both loading and import in one step. "Compound" libraries
> [...] must be done manually and is not directly supported by the new
> system.
> [...]
> The underlying machinery is still the same, but in the interest of making
> things simpler for the user, the high-level view that can be specified in
> egg files provides fewer options.
> [...]

I can't say that I like this design decision, but I guess I'll have to
live with it. If this is unsupported, it also feels strange that
the .egg format allows specification of multiple import libraries per
extension at all – the provider side of the picture, when you write a
library with multiple modules, is supported, but the consumer side,
when you try to use it, is suddenly not supported any longer.

You also suggest that separating load and import is possible when done
"manually", but I couldn't find any information on how one would
approach that. Could you elaborate this "manual" approach a little bit?

> > [...]
> > - If an (extension ...) form in an .egg file lists modules that have a 
> > composite name, such as (foo bar), the egg installation process then tries 
> > to 
> > pass the literal "(foo bar)" as a component of the import library name to 
> > the 
> > compiler and it appears in the generated install script. Is this a bug or 
> > is it 
> > intentional? It seems inconsistent with the name mangling using "." between 
> > module name components that is applied elsewhere.
> This is a bug. Compound names should be canonicalized using "." syntax
> when they appear in user forms. If you can provide a simple example, we can 
> try to address this.
> [...]

$ cat foobar.scm
(module (foo bar)

(define (hello)
  (display "Hello world!")


$ cat foobar.egg
   (extension foobar
     (modules (foo bar)))))

$ chicken-install -n
building foobar
   /opt/chicken/bin/csc -setup-mode -s -host -I /home/murphy/foobar -C
-I/home/murphy/foobar -O2 -d0 /home/murphy/foobar/(foo bar).import.scm
-o /home/murphy/foobar/(foo bar) csc: file
`/home/murphy/foobar/(foo bar).import.scm' does not exist

Error: shell command terminated with nonzero exit code
"sh /home/murphy/foobar/"

> > [...]
> > - How can I compile multiple source files, for example one scheme file and 
> > several C files, into an extension library in an .egg file? As far as I can 
> > see, the only way to do that is a custom build script, but that has 
> > problems of 
> > its own. In particular it is nearly impossible to do this right in the case 
> > of 
> > static linking, where CHICKEN seems to expect a single object file output 
> > (yes, 
> > ELF object files can be merged, but that's a pain in the rear).
> Yes, use a custom build script. I'm working on a way to handle the case of 
> separate
> ..c files that need to be linked. Due to how we support static linking this 
> is 
> not trivial.
> [...]

How about producing .a / .lib files instead of .o files for static
linkage – wouldn't that simplify including multiple compilation units?

Thanks again for the useful feedback!


Liebe ist die beste Geisteskrankheit, die man sich wünschen kann.
-- Lisa Eckhart

reply via email to

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