@@ -22,10 +22,11 @@ codegenC :: [(Name, SDecl)] ->
2222 String -> -- output file name
2323 Bool -> -- generate executable if True, only .o if False
2424 [FilePath] -> -- include files
25+ String -> -- extra object files
2526 String -> -- extra compiler flags
2627 DbgLevel ->
2728 IO ()
28−codegenC defs out exec incs libs dbg
29+codegenC defs out exec incs objs libs dbg
2930 = do -- print defs
3031 let bc = map toBC defs
3132 let h = concatMap toDecl (map fst bc)
@@ -38,7 +39,9 @@ codegenC defs out exec incs libs dbg
3839 hPutStr tmph cout
3940 hFlush tmph
4041 hClose tmph
41− let gcc = "gcc -x c " ++
42+ let useclang = False
43+ let comp = if useclang then "clang" else "gcc"
44+ let gcc = comp ++ " -I. " ++ objs ++ " -x c " ++
4245 (if exec then "" else " - c ") ++
4346 gccDbg dbg ++
4447 " " ++ tmpn ++
@@ -150,7 +153,7 @@ bcc i (ERROR str) = indent i ++ "fprintf(stderr, " ++ show str ++ "); assert(0);
150153
151154c_irts FInt l x = l ++ "MKINT((i_int)(" ++ x ++ "))"
152155c_irts FChar l x = l ++ "MKINT((i_int)(" ++ x ++ "))"
153−c_irts FString l x = l ++ "MKSTR(" ++ x ++ ")"
156+c_irts FString l x = l ++ "MKSTR(vm, " ++ x ++ ")"
154157c_irts FUnit l x = x
155158c_irts FPtr l x = l ++ "MKPTR(vm, " ++ x ++ ")"
156159c_irts FDouble l x = l ++ "MKFLOAT(vm, " ++ x ++ ")"