Silverfrost Forums

Welcome to our forums

Preprocessor parameter passing

26 Aug 2016 3:28 #17909

From the documentation I see this line;

The pre-processor can only be used for conditional compilation. Macro substitution is not supported.

Which I guess rules out overriding parameters from the command line.

I've tried

ftn95 file.f90 /VPARAM maxabcval 8192

and in Fortran;

PARAMETER (maxabc=maxabcval)

But this yields a compilation error.

Is there another way to pass in values for compilation time or is this not possible?

Thanks in advance

Ryan

26 Aug 2016 5:05 #17910

You could place the PARAMETER statement in an include file, and place an INCLUDE statement in every subprogram that needs to use that parameter.

You could use another preprocessor on your source code that utilizes macros and run that preprocessor before feeding its output to the Fortran compiler.

26 Aug 2016 5:55 #17911

Both of those are good options, thank you.

28 Aug 2016 4:07 #17923

I've only used these in conditional compilations.

I've tried everything in the documentation (and a few others) to get this to work, and cannot.

Perhaps a bug?

Please login to reply.