> on my system I got the usual "undeclared" error for scalb and scalf. I
> can't understand the reason, they are declared in bits/mathcall.h,
> which is included by math.h.
Looking at bits/matchcalls.h, the declarations for scalb() are only
included-in by the preprocessor if either of these macros are set;
# if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
These get set only by the compiler, and only if you #define
_GNU_SOURCE before the first system file is included (see my post to
the devel. list below).
It's an open issue among the developers how to deal with this.
> So I added the two prototypes to linux.c and compiled it without
That is pretty much all you can do at the moment.
---- Begin forwarded message -------
>From hin Fri Aug 8 16:17:24 -0400 2003
From: "John K. Hinsdale" <hin@...>
Subject: Re: Problems in modules/glibc/linux.lisp
> Can you replace
> ; You can uncomment this if your compiler sets __USE_GNU
> (c-lines "#define __USE_GNU~%")
It turns out you cannot set __USE_GNU directly; it is internal to the
compiler and treated very specially. It can be inspeced with #ifdef,
but it can only be turned on by the compiler (#define __USE_GNU does
nothing), and even then only by #define'ing
prior to the VERY FIRST #include of any system header file. (Much
experimentation has led me to these facts). This also triggers other
defines that bring in BSD and POSIX calls. This is all for my Linux
2.4.20 environment, with gcc 2.95.4. This is a pretty common
environment as many are still clinging tightly to GCC 2.95.
Now, it does not work to just do
(c-lines "#define _GNU_SOURCE~%")
at the start of linux.lisp, because in the generated file "C"
file, the FFI sticks
before anything generated via C-LINES. And "clisp.h" in turn does a
thereby ensuring that __USE_GNU will not be set for the build of the
Pretty messy, eh?
So we either need to:
1 - live without the function calls that are exported
only when __USE_GNU is set. Not desirable?
2 - Set _GNU_SOURCE buildwide in "clisp.h". I don't know
whether this is a good idea. Your call.
3 - Give the FFI away to let the module stick lines in
the output that will come before the
Please let me know which option you prefer.
I should at least fix the comments in the Lisp file reading "if your
compiler sets __USE_GNU" are nonsensical: the end user sets __USE_GNU
indirectly, not the compiler.
John Hinsdale, Alma Mater Software, Inc., Tarrytown, NY 10591-3710 USA
hin@... | http://www.alma.com/staff/hin | +1 914 631 4690