From 57ee6923d9c9eb2f1d42e5552e0cb15e43334835 Mon Sep 17 00:00:00 2001 From: Yash Thakur <45539777+ysthakur@users.noreply.github.com> Date: Mon, 16 Dec 2024 18:31:11 -0500 Subject: [PATCH] Add runtime.h to generated C file again --- src/main/scala/fred/Compiler.scala | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/scala/fred/Compiler.scala b/src/main/scala/fred/Compiler.scala index 58d5e67..a54f487 100644 --- a/src/main/scala/fred/Compiler.scala +++ b/src/main/scala/fred/Compiler.scala @@ -76,10 +76,9 @@ object Compiler { .getResourceAsStream(RuntimeHeader) val io = ProcessIO( in => { - in.write(generated.getBytes()) - // in.write(runtimeHeader.readAllBytes()) + in.write(runtimeHeader.readAllBytes()) // TODO removing #include runtime.h is a horrendous hack - // in.write(generated.replaceAll("#include \"runtime.h\"", "").getBytes()) + in.write(generated.replaceAll("#include \"runtime.h\"", "").getBytes()) in.close() }, out => print(String(out.readAllBytes())), @@ -89,7 +88,7 @@ object Compiler { val extraIncludes = if (settings.includeMemcheck) "-I /usr/include/valgrind" else "" - assert(s"gcc -g -I ${includesFolder()} $extraIncludes -o $outExe -x c -".run(io).exitValue() == 0) + assert(s"gcc -g $extraIncludes -o $outExe -x c -".run(io).exitValue() == 0) File(outExe).setExecutable(true) runtimeHeader.close()