This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: fdopen() linker error
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?
--
Gary Thomas <gary@mlbassoc.com>
MLB Associates
Index: isoinfra/current/include/stdio.h
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/isoinfra/current/include/stdio.h,v
retrieving revision 1.6
diff -u -5 -p -r1.6 stdio.h
--- isoinfra/current/include/stdio.h 15 Mar 2004 15:20:23 -0000 1.6
+++ isoinfra/current/include/stdio.h 26 Sep 2004 12:18:34 -0000
@@ -137,15 +137,20 @@
# ifdef __cplusplus
extern "C" {
# endif
+//
+// Some traditional I/O functions
+//
+#ifdef CYGPKG_IO_FILEIO
extern int
fileno( FILE *__stream ) __THROW;
extern FILE *
fdopen( int __fildes, const char *__type ) __THROW;
+#endif
# ifdef __cplusplus
} // extern "C"
# endif
# endif
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss