chicken-users
[Top][All Lists]
Advanced

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

Re: Using block compilation with compilation units


From: Jörg F. Wittenberger
Subject: Re: Using block compilation with compilation units
Date: Mon, 27 Dec 2021 11:28:34 +0100

Hello Robert,

you are right, you can not directly call procedures from modules/units
compiled with -block.

A trick I used to "export" procedures was to have two compilation units
(I used modules for both).  One, the "hook", defining and exporting top
level bindings, which is not compiled in block mode and a second
"implementer", which imports from hook and used `set!` to assign the
bindings.  Other modules only import hook.  (Gotcha: Be sure to force
initialization of the implementer before any other use of those
bindings.)

I'm curious how much this loop-hopping would benefit you.

One nice side effect it has: changing the import list of the
implementer module will no longer require a re-compile of modules using
the hook.

Am Mon, 27 Dec 2021 00:39:37 -0330
schrieb Robert Coffey <foggynight709@gmail.com>:

> Hello,
> 
> I am trying to figure out how block compilation works, as I would
> like to build
> my project with -O5 if possible, but I'm having issues getting my
> project to build with block compilation.
> 
> It appears calling procedures defined in other compilation units
> causes segmentation violations, which aligns with "toplevel bindings
> are not seen by
> eval and unused toplevel bindings are removed" as stated in the
> manual, but this
> leaves me unsure about how (or if you can) split a program into
> compilation units while using block compilation.
> 
> Do I need to use modules in order to have access to procedures in
> other "units", or is there a way to use compilation units?
> 
> Thanks,
> Robert Coffey




reply via email to

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