chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] How to load an extension?


From: Alejandro Forero Cuervo
Subject: Re: [Chicken-users] How to load an extension?
Date: Mon, 5 Jul 2010 23:20:15 +0200
User-agent: Mutt/1.5.13 (2006-08-11)

This makes perfect sense.  Thanks for the explanation.

> > If an extension called, say, 'hello' has been installed, what's the
> > canonical way, with Chicken 4, to load it?
> 
> (require-extension hello)
> 
> > 
> > I'm confused with require-extension, require-library, require, import,
> > use and declare uses.  I'm looking for an answer that only has two
> > words, the second being "hello", and two parenthesis.  I would hate to
> > find out that one must use the words like "depends" to answer this
> > question.
> 
> (require-extension hello)
> 
> "hello" in this case should be a normal, canonical, standard extension
> library for the CHICKEN Scheme system. It's always `require-extension'
> for these. When in doubt, use `require-extension'.
> 
> If the extension does not provide a module (which implies it also
> doesn't provide an import library), which means it is *NOT* a normal,
> canonical, standard extension library for the CHICKEN Scheme system,
> then of course, it depends.
> 
> > 
> > PPs: http://chicken.wiki.br/eggs%20tutorial seems confusing, it talks
> > about mpeg.import.scm without specifying that it's an autogenerated
> > file and it assumes that mpeg.scm uses "(module ...)", which may not
> > be the case.  I'd recommend fixing that or erasing that page
> > (replacing it with a link to the proper documentation that egg authors
> > should use).
> 
> I will try to improve this page. All existing documentation is indeed
> confusing, and everybody (including myself) gets regularly confused
> about the correct way to use extensions, but that is caused by
> some things that, AFAICT, can not be easily circumvented:
> 
> 1. There exists an alias to `require-extension' called `use', which is
>    totally equivalent, but short. I wouldn't want to remove this,
>    because, lazy as I am, I try to reduce keypresses here and there,
>    particularly for boilerplate forms like this.
> 
> 2. CHICKEN supports static linking of extensions in a relatively
>    convenient manner, something very few language implementations
>    provide. Since this influences translation, compilation,
>    linking/loading, extension-building and extension-installation, it
>    necessarily requires some machinery (even if controlled by obscure
>    command-line-options or non-standard loading/linking forms).  Note
>    that you don't have to worry about this, if you are just trying to
>    put together normal extensions.
> 
> 3. It is also possible to link library units into a single shared
>    library (that's what libchicken.so is, in the end), this and static
>    linking requires all this "unit" stuff that appears in the manual.
> 
> So things are actually not that bad:
> 
> (require-extension X)/(use X) loads and imports an extension module.
> 
> (require-library X) loads an extension, but doesn't import.
> 
> (import X) imports a module, which must have been loaded somehow.
> 
> Just ignore the rest. Don't worry about static linking until you need
> it. Write extensions that use `(module ...)' and all is well.

Alejo.
http://azul.freaks-unidos.net/



reply via email to

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