Problems with Fortran INCLUDE and Preprocessor

Richard E Maine Richard.Maine@NASA.GOV
Tue Aug 16 19:58:00 GMT 2005


On Aug 16, 2005, at 9:13 AM, Douglas Vechinski wrote:

> On Tue, 2005-08-16 at 07:56 -0700, Richard E Maine wrote:
>> Mixing C preprocessing and Fortran includes in ways like this causes
>> similar problems on may platforms. It is not g77-specific....
>> Approaches like that are the most portable way of handling such mixes.
>
> How is separating the steps manually any different than letting the
> compiler do it for you.

In many ways. I'm not speculating about it having portability problems. 
My comment is based on many, many cases of users reporting various 
related difficulties on many platforms. The observed fact of the 
difficulties is much more relevant than the details of how it can 
happen. But since you ask, a few ways are:

1.  The one mentioned by Douglas Vechinski, namely that the temporary 
file created by the preprocessor might be in a separate directory. 
Apparently that's what bit you. Although I haven't verified that, it 
seems plausible to me.

2. Perhaps the most common related problem I've seen, although it 
doesn't appear to be the one that bit you, is that the C preprocessor 
runs on the .F file *BEFORE* the Fortran processor runs and "sees" the 
Fortran includes. This causes C preprocessing directives in the 
included files to be ignored. This one can be quite a pain to work 
around.

-- 
Richard Maine                |  Good judgment comes from experience;
Richard.Maine@nasa.gov       |  experience comes from bad judgment.
                             |        -- Mark Twain



More information about the Fortran mailing list