LingDong-/wax

How to #include with C backend?

Closed this issue · 1 comments

How can I get a valid #include for C?

(asm "#include \"some_file.h\"")
(func main (result int)
    (return 0)
)

gives malformed include

#include "some_file.h"int main() {
    return 0;
}

I tried using an escaped newline and escaping the backslash in the newline but this was included raw into the final output instead of actually escaping a new line

(asm "#include \"some_file.h\"\n")
(func main (result int)
    (return 0)
)

gives

#include "some_file.h"\nint main() {
    return 0;
}

This works

(asm "#include \"some_file.h\"
")
(func main (result int)
    (return 0)
)

Its not what I expected but does make sense 😄