Call an external program from CTFE

realhet real_het at hotmail.com
Sun Jun 23 16:33:54 UTC 2024


Hi,

Is there a way to call an external program from CTFE?


Use case:
Inside a module I want to put some GLSL code.
I also want to generate that GLSL code using CTFE.
And when it's done, it would be nice if I was able to save that 
GLSL code into a temp file and call the glsl compiler on it.
The goal is that the compiled version of the module would contain 
also the compiled version of that GLSL shader.
And the time of the GLSL compilation could be the exact same time 
of the EXE compilation.

This sounds a bit of hacking, but from viewing from a 
multi-target build perspective, it can make sense.  Calling a 
compiler from another compiler... Why not? :D

The nearest thing I've found is the "include file contents" 
'macro', that can be enabled with a command line parameter. 
(Maybe it's already deprecated, I'm not sure.)


My other way to do this would be an automation inside my IDE.  
But if something could be done on the language level it's always 
better than doing it by using external tools.


More information about the Digitalmars-d-learn mailing list