How can I run the MSVC preprocessor and compiler in two separate steps?

后端 未结 2 910
孤独总比滥情好
孤独总比滥情好 2021-01-12 00:14

I\'d like to run the Microsoft Visual Studio Compiler cl.exe without invoking the preprocessor. Is this possible? I thought that simply compiling preprocessed s

相关标签:
2条回答
  • 2021-01-12 00:19

    To my knowledge there is no way to run the compiler without the preprocessor (regardless of the fact that it doesn't do anything.

    However seperating the 2 stages will obviously be slower as you are adding a write to file and then read back of that file. If it doesn't need to do those writes it can hold it in memory and you save a tonne of time waiting for the disk to be written to & read from.

    ie Even if you could disable the pre-processor it would still be slower than running both stages simultaneously.

    0 讨论(0)
  • 2021-01-12 00:25

    It may well be that a lot of the time you think the preprocessor is taking is actually time spent writing that large file to disk. The preprocessor should actually take a tiny percentage of the time that the rest of the compiler takes. A big benefit of a normal pre/compilation is that the the compiler can begin compiling while the preprocessor stage is still running, perhaps in a separate thread or as it detects new preprocessor output. The large preprocessor output may not need to ever occupy memory (let alone disk), as it's consumed and overwritten in smaller chunks.

    0 讨论(0)
提交回复
热议问题