Lazarus
Programming => General => Topic started by: fasdfasdfasdfasdfasdf on December 06, 2018, 04:01:27 pm
-
I am trying to run the CPP preprocessor before compiling with FPC.
However it seems that FPC does not allow for using stdin for compilation.
cat somefile | gcc -E -fpreprocessed -xc - | fpc -O4
-
Even if it would, FPC can need to load sourcecode (units) independently, so this would be of extremely limited use.
If you want to use the preprocesor, store the result of all files, and then compile.
-
Could I use something like namedpipes?
-
Afaik no, there is no way, except storing the intermediate results.
-
If using preprocessor this way, the line number for error messages will not fit the original sourcecode but the preprocessed source.
-
Neither will it any other way, since when piping the compiler also only sees the preprocessed source. (in C this works by emitting #line directives, which of course won't work for pascal)
FPC simply does not integrate external preprocessing into the buildprocess. That is more something for languages without unitsystem.
Gnu Pascal might be a better way in such case.
-
AFAIK GDB has support for macros.