I want to create a macro using the crate cpp, however this crate has issues with macro expansion.
Context
The crate works by taking cpp!{ ... }
macros of inline C code, compiling their contents as functions, and replacing the macro call with the resulting function. This is triggered by calling cpp_build::build("src/lib.rs")
in the build.rs
.
Issue
As stated by the crate's authors, the cpp!
macro is compiled before macro expansion can occur. This means it will attempt to interpret the arguments of the macro as-is and expand inside of the macro declaration.
Is there a way I can trigger the expansion of specific macros or files inside of the build.rs
before I call the cpp_build
function?