This is the mail archive of the
ecos-patches@sources.redhat.com
mailing list for the eCos project.
Re: [ECOS] fdopen() linker error
- From: Jonathan Larmour <jifl at eCosCentric dot com>
- To: Gary Thomas <gary at mlbassoc dot com>
- Cc: Øyvind Harboe <oyvind dot harboe at zylin dot com>,eCos Discussion <ecos-discuss at ecos dot sourceware dot org>,eCos Patches List <ecos-patches at ecos dot sourceware dot org>
- Date: Mon, 27 Sep 2004 12:26:55 +0100
- Subject: Re: [ECOS] fdopen() linker error
- References: <1096039064.23830.25.camel@famine> <41543CB7.4000400@iv.ro> <109 6130972.25269.1.camel@famine> <1096157695.28824.471.camel@hermes> <1096191343.1496.1.camel@famine> <1096201248.28824.478.camel@hermes>
Gary Thomas wrote:
On Sun, 2004-09-26 at 03:35, Øyvind Harboe wrote:
søn, 26.09.2004 kl. 02.14 skrev Gary Thomas:
On Sat, 2004-09-25 at 10:49, Øyvind Harboe wrote:
You need to add the fileio package I think
look at the ifdef around fdopen() in
language/c/libc/stdio/current/src/common/fopen.cxx
Ouch, I should have figured that one out.
Is it the intended behaviour that there is only an error link time and
not at compile time?
There should be a compile time error if you build with -Wall
Otherwise, C blissfully (cute, huh(1)?) will compile anything
and not complain until you try to link it.
In that case, there is a missing #if in the header files for fdopen() +
the other prototype next to it.
Agreed - a generic header like "stdio.h" should not export anything
unless it is well known to be available. The attached patch would
seem appropriate. Jonathan?
One of the purposes of the fileio package is to abstract the implementation
without being implementation specific, so this patch wouldn't be quite
right as specific packages shouldn't be mentioned (yes there are already
some exceptions but that's because I didn't put them there :-)).
But in any case if you look a few lines further up in the file, you'll the
real problem is that something must be defining (or rather implementing)
CYGINT_ISO_STDIO_POSIX_FDFUNCS despite the implementation not being there.
The only implementor of this is CYGPKG_LIBC_STDIO_OPEN, which indeed
doesn't do the right thing because looking at the code in
language/c/libc/stdio/current/src/common/fopen.cxx it also depends on
CYGPKG_LIBC_STDIO_FILEIO.
So the correct fix which I've checked in is:
Index: ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/stdio/current/ChangeLog,v
retrieving revision 1.30
diff -u -5 -p -r1.30 ChangeLog
--- ChangeLog 18 Aug 2004 14:11:59 -0000 1.30
+++ ChangeLog 27 Sep 2004 11:25:34 -0000
@@ -1,5 +1,10 @@
+2004-09-27 Jonathan Larmour <jifl@eCosCentric.com>
+
+ * cdl/stdio.cdl (CYGFUN_LIBC_STDIO_OPEN_POSIX_FDFUNCS): New option,
+ to control whether or not fdopen()/fileno() are implemented.
+
2004-08-18 Jonathan Larmour <jifl@eCosCentric.com>
* cdl/stdio.cdl (CYGDAT_LIBC_STDIO_DEFAULT_CONSOLE): Only use
CYGDAT_IO_SERIAL_TTY_CONSOLE if set.
Index: cdl/stdio.cdl
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/stdio/current/cdl/stdio.cdl,v
retrieving revision 1.13
diff -u -5 -p -r1.13 stdio.cdl
--- cdl/stdio.cdl 18 Aug 2004 14:11:59 -0000 1.13
+++ cdl/stdio.cdl 27 Sep 2004 11:25:34 -0000
@@ -272,24 +272,33 @@ cdl_package CYGPKG_LIBC_STDIO {
saved, and speed is improved. Note that you
MUST have this defined if you want to use the
scanf() family of functions."
}
- cdl_option CYGPKG_LIBC_STDIO_OPEN {
+ cdl_component CYGPKG_LIBC_STDIO_OPEN {
display "Dynamic opening/closing of files"
requires CYGINT_ISO_MALLOC
- implements CYGINT_ISO_STDIO_POSIX_FDFUNCS
default_value { 0 != CYGINT_ISO_MALLOC }
description "
fopen() and fclose() use dynamic memory
allocation routines to allocate memory for
new FILE structure pointers. If a malloc
implementation is available, this option
may be enabled to use
fopen() and fclose(). If disabled, only the
default console streams - stdin, stdout and
stderr - will be available."
+
+ cdl_option CYGFUN_LIBC_STDIO_OPEN_POSIX_FDFUNCS {
+ display "POSIX fdopen/fileno functions"
+ active_if CYGPKG_LIBC_STDIO_FILEIO
+ implements CYGINT_ISO_STDIO_POSIX_FDFUNCS
+ calculated 1
+ description "This identifies to the rest of the system
+ whether the POSIX fdopen() and
+ fileno() functions are implemented."
+ }
}
cdl_option CYGDAT_LIBC_STDIO_DEFAULT_CONSOLE {
display "Default console device"
flavor data
Jifl
--
eCosCentric http://www.eCosCentric.com/ The eCos and RedBoot experts
--["No sense being pessimistic, it wouldn't work anyway"]-- Opinions==mine