Re: fortran source file renamed when using preprocessor directives




"Arjen Markus" <arjen.markus@xxxxxxxxxx> wrote in message
news:1193735892.964953.231140@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

This type of preprocessing uses the C preprocessor which
does not "know" anything about Fortran. So there are
certain things (like macro expansion) that won't work
properly.
How is the original post fortran as opposed to c?

--
wade ward

President
Merrill Jensen Consulting


wade@xxxxxxxxxxx
435 -838-7760


g77 itself seems to handle preprocessing by:
- running the C preprocessor, thus generating a temporary
file in /tmp
- compiling this temporary file instead of the original
source code.

I do not think it has much choice there: due to preprocessing
the number of lines may change and the contents as well,
so that there is very little relation between the original
file and the preprocessed one.

One solution I can think of is, that you preprocess the files yourself
and keep the preprocessed source around:

cpp test.F pp/test.f
g77 -o test.o -c pp/test.f

(keep them in a separate directory to avoid confusion)

If all you need is to INCLUDE files, then there is no
need for this preprocessing. The Fortran compiler will
take care of it.
Writing c with g77? What could go wrong there?
--


.



Relevant Pages

  • Re: fortran source file renamed when using preprocessor directives
    ... I have written a simple FORTRAN program which include some header ... and tried to debug with gdb: ... Can't we retain the same file name even after the preprocessing *.F ...
    (comp.lang.fortran)
  • [OT] automatically write enabled macros of the makefile into a file
    ... I have a very large code written in fortran 90. ... #endif constructs) in the makefile and make+run the code. ... to know which macros were enabled and which macros were disabled during the ... much easier, if, before preprocessing the code, there is a way to ...
    (Debian-User)
  • Re: Does g77 allows #include directives in FORTRAN 77 applications
    ... a fundamental difference is that #include is not Fortran. ... reasonably common to use non-Fortran means to preprocess #include. ... Fortran compilers might happen to do this for you. ... preprocessing has implications. ...
    (comp.lang.fortran)
  • Re: BIND and ELEMENTAL
    ... fix it with preprocessing to get a C version then. ... I have found that I can link to c++ too with g95, ... you should be able to write your C++ routines using ... to call them from Fortran you don't want to do those anyway. ...
    (comp.lang.fortran)
  • Re: Linux X demo
    ... Compilation can involve up to four stages: preprocessing, ... C source code which should not be preprocessed. ... library to make an Objective-C program work. ...
    (alt.lang.asm)