Generating code at compile-time using scripts
        Posted  
        
            by Manux
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Manux
        
        
        
        Published on 2010-06-17T17:22:28Z
        Indexed on 
            2010/06/17
            17:33 UTC
        
        
        Read the original article
        Hit count: 263
        
Hello,
I would ideally like to be able to add (very repetitive) C/C++ code to my actual code, but at compile time, code which would come from say, the stdout of a python script, the same way one does with macros.
For example, let's say I want to have functions that depend on the public attributes of a given class, being able to just write the following in my C++ code would be a blessing:
generate_boring_functions(FooBarClass,"FooBarClass.cpp")
Is that feasible using conventional means? Or must I hack with Makefiles and temporary source files?
Thanks.
© Stack Overflow or respective owner