chicken-hackers
[Top][All Lists]
Advanced

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

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


From: felix . winkelmann
Subject: Re: [Chicken-hackers] Some questions about CHICKEN 5 eggs and modules
Date: Wed, 29 Aug 2018 10:57:54 +0200

> As far as I understand the question (probably not really), a simple way to
> do this is to (foreign-declare "#include \"foo.c\"") and add foo.h to the
> source-dependencies of the file (see for example the simple-sha1 and
> simple-md5 eggs, they do this).  No need for any special handling.
>
> Of course it means your C files get a lot larger, and you don't benefit
> from reduced compilation times from separate compilation.

That's right, this will work in many cases. On the other hand, foo.c
will be compiled in the environment that chicken.h defines, including
all macro and type definitions, which may pollute what foo.c expects
to be seen. "Reparing" the environment may range from difficult to
impossible should foo.c have name clashes with anything defined
in chicken.h. Moreover, foo.c may need special compilation flags
that are not compatible with CHICKEN-generated source code.

The foreign-declare case is simple and straightforward and should
be used, if possible, but we need a fallback solution and this case
of a separate .c file is common enough to be addressed.


felix




reply via email to

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