chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] compilation question


From: Felix Winkelmann
Subject: Re: [Chicken-users] compilation question
Date: Mon, 16 Dec 2002 10:04:56 +0100
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.0.0) Gecko/20020530

Peter Keller wrote:

Suppose I have this set of functions and files:
>
>[...]

Now suppose I compile bar1.scm, bar2.scm, bar3.scm, and top.scm separately
and link them all together to form an executable. How many copies of
count1, count2, and count3 are there going to be, and is an invocation
of count1 in bar1.scm, bar2.scm, or bar3.scm going to produce the correct
monotonically increasing number that is unique between bar1.scm, bar2.scm,
and bar3.scm?

How is this dealt with?

You will get one copy for each "include": include copies the source file
directly into the compiled code. A better way would be to put
make-counter and countN into a separate library unit and declare
that as used:

;;;; counts.scm

(declare (unit counters))

(define make-counter ...)
(define count1 ...)
...

;;; bar1.scm:

(declare (unit bar1) (uses counters))
...

etc.


This comes up because I want to generate unique identifiers for each
result object in my testing infrastructure, but if the above ever happens
in someone's project, I don't know what is going to happen. Since it is
easy to write temendously sized test suite codes, I think people would
want separate compilation to speed up the development process.


Yeah, that's true. We can put any support code into a separate
library unit and link it the libchicken (or libstuffed-chicken).
The test-infrastructure.scm could then simply declare that
support unit as used.


cheers,
felix




reply via email to

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