`clever' C preprocessor trick now causes problems

Rosimildo da Silva rdasilva at connecttel.com
Tue Sep 25 00:45:38 UTC 2001


From: "Eric Norum" <eric.norum at usask.ca>
To: <rtems-users at oarcorp.com>
Sent: Monday, September 24, 2001 5:39 PM
Subject: `clever' C preprocessor trick now causes problems


> I'm using RTEMS as a platform for EPICS (Experimental Physics and
> Industrial Control System).  The EPICS sources assume a full NFS
> connection to the file server and opens files with pathnames like:
>         ../foobar.dbd
>         ../../db/bletch.db
>         ./blahblahblah.cmd
> 
> To provide similar functionality on RTEMS I compile the EPICS sources
> with a `-Dfopen=rtems_fopen' command-line flag.  The rtems_fopen routine
> strips off any leading ./ or ../ characters, prepends
> /TFTP/<<bootp_host>>/epics/<<hostname>>/ and then passes that name to
> the real fopen routine.  Neat trick, huh?  I thought so too, at the
> time.  Now I don't.  :-(
> 

I personally, gave up "clever" tricks a long ago. They all came back, and 
caused toons of problems.....

> 
> This of course causes an error since there' no prototype for fopen
> because the command-line definition forces the prototype in stdio.h to
> look like FILE *rtems_fopen (....
> 
> And yes, there are C++ source files that call fopen so I can't get
> around the problem by just using the command-line redefinition for C
> source files.
> 
> I'm at a bit of a loss as to how to get around this without hacking up
> either the GCC header files or the EPICS source.  Till now I've been
> able to avoid messing with either, and I'd like to keep it that way.
> 

I would hack the EPICS source, once for all... and live with the 
C++ standards.....

Tkae care, Rosimildo.






More information about the users mailing list