On Tue Sep 15, 2026 at 2:52 PM CEST, Diego A. Mundo via Chicken-users wrote:
> Hi all,
>
> I was playing around with the (modules ...) .egg component property in an 
> attempt to produce multiple modules from the same file, but found it does not 
> produce individually importable modules.
>
> An example of this is the srfi-99 egg, which defines multiple modules in the 
> egg file, but only the one with the same name as the file can be imported 
> (e.g. importing srfi-99-primitives fails without first importing srfi-99). An 
> extension without any modules matching the file name produces no importable 
> modules. In all cases .import.so files are generated, though.
>
> This behavior is present in both C5 and C6. Is this a bug, or am I mistaken 
> about the purpose of the modules property?

The default behaviour for loading + importing a module is to look for
a file named <extension>.so + <extension>.import.[so|scm], to make both
steps (loading and importing) automatic and easy to handle. Since
loading code and importing a module, making available the bindings,
are separate steps, various scenarios are possible, where code is
loaded (or linked) in different situations, but the imports are done
selectively. An example is libchicken, which holds a lot of module
code, with separate import libraries for importing the parts you
want to access.

The "modules" egg property allows generating and compiling multiple
import libraries, but the loading of the associated code is not
handled by this, it has to be done manually, or linked in statically,
or loaded with a "container" library that holds various submodules.

For normal extensions produced by eggs I recommend to stay with the
one-file, one-import lib convention.

I hope this explains it somewhat.


cheers,
felix


Reply via email to