View previous topic :: View next topic |
Author |
Message |
Ryan
Joined: 25 Feb 2016 Posts: 110
|
Posted: Fri Aug 26, 2016 4:28 pm Post subject: Preprocessor parameter passing |
|
|
From the documentation I see this line;
Quote: | 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
Code: | ftn95 file.f90 /VPARAM maxabcval 8192 |
and in Fortran;
Code: | 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 |
|
Back to top |
|
|
mecej4
Joined: 31 Oct 2006 Posts: 1886
|
Posted: Fri Aug 26, 2016 6:05 pm Post subject: |
|
|
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. |
|
Back to top |
|
|
Ryan
Joined: 25 Feb 2016 Posts: 110
|
Posted: Fri Aug 26, 2016 6:55 pm Post subject: |
|
|
Both of those are good options, thank you. |
|
Back to top |
|
|
wahorger
Joined: 13 Oct 2014 Posts: 1217 Location: Morrison, CO, USA
|
Posted: Sun Aug 28, 2016 5:07 am Post subject: |
|
|
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? |
|
Back to top |
|
|
|