PDA

View Full Version : How do I invoke a C preprocessor when using LF95?


R. T. (Fortran Man)
08-04-2004, 06:34 PM
How do I invoke a C preprocessor when using LF95?

I'm trying to compile Fortran source that contains preprocessor commands like;
#include "fortran_header.h"
#define MODE1
#ifdef MODE1
cond=1.e38
#else
cond=1.e50
#endif

Can a C preprocessor invoked by LF95 so that these commands can be used?

Lahey Support
08-04-2004, 06:40 PM
Yes, LF95 can invoke a C preprocessor. This can be used to control/support conditional compilation statements.

To invoke the C preprocessor use the following undocumented compiler option. Note that this option is case sensitive and begins with a lowercase letter L not the number one.

-lfe "-Cpp"

Options used to define preprocessor variables must also be prefixed with -lfe and in quotes. The following would be used to invoke the C preprocessor and define the variables varone and vartwo:

lf95 source.f90 -lfe "-Cpp" -lfe "-Dvarone" -lfe "-Dvartwo"

Note that every variable definition must have a unique -lfe prefix and be in quotes.