Skip to content

Commit

Permalink
Add runtime.h to generated C file again
Browse files Browse the repository at this point in the history
  • Loading branch information
ysthakur authored Dec 16, 2024
1 parent 56eee0f commit 57ee692
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/main/scala/fred/Compiler.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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())),
Expand All @@ -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()
Expand Down

0 comments on commit 57ee692

Please sign in to comment.