I need to add a prefix to names by using preprocessor. The idea is best expressed thus:
#define PREFIX_ ns1_ /*<< this definition comes from outside */ #define MANGLE(name) CONCAT(EXPAND(PREFIX_),name) #define EXPAND(a) a #define CONCAT(a,b) CONCAt(a,b) #define CONCAt(a,b) a/**/b /*<<note: operator ## not supported */ call MANGLE(foo) /*<<fortran should see: call ns1_foo */
This code works with nearly all preprocessors, but iIt does not work with PGI internal preprocessor (produces “call PREFIX_foo”). Is there a way to do what I need with PGI Fortran preprocessor or the only option is to preprocess the file with a separate pass?
Preprocessing: pgf90 -Mpreprocess -E x.F