@@ -589,7 +589,7 @@ ifaceC (ExportFun n cn ret args)
589589 argNames = zipWith (++) (repeat "arg") (map show [0..])
590590
591591mkBody n as t = indent 1 ++ "INITFRAME;\n" ++
592− indent 1 ++ "RESERVE(" ++ show (length as) ++ ");\n" ++
592+ indent 1 ++ "RESERVE(" ++ show (max (length as) 3) ++ ");\n" ++
593593 push 0 as ++ call n ++ retval t
594594 where push i [] = ""
595595 push i ((n, t) : ts) = indent 1 ++ c_irts (toFType t)
@@ -601,6 +601,15 @@ mkBody n as t = indent 1 ++ "INITFRAME;\n" ++
601601 indent 1 ++ "ADDTOP(" ++ show (length as) ++ ");\n" ++
602602 indent 1 ++ "CALL(" ++ cname n ++ ");\n"
603603
604+ retval (FIO t)
605+ = indent 1 ++ "TOP(0) = NULL;\n" ++
606+ indent 1 ++ "TOP(1) = NULL;\n" ++
607+ indent 1 ++ "TOP(2) = RVAL;\n" ++
608+ indent 1 ++ "STOREOLD;\n" ++
609+ indent 1 ++ "BASETOP(0);\n" ++
610+ indent 1 ++ "ADDTOP(3);\n" ++
611+ indent 1 ++ "CALL(" ++ cname (sUN "call__IO") ++ ");\n" ++
612+ retval t
604613 retval t = indent 1 ++ "return " ++ irts_c (toFType t) "RVAL" ++ ";\n"
605614
606615ctype (FCon c)
@@ -615,7 +624,7 @@ ctype (FApp c [_])
615624 | c == sUN "C_Any" = "VAL"
616625ctype (FStr s) = s
617626ctype FUnknown = "void*"
618−ctype FWorld = "void*"
627+ctype (FIO t) = ctype t
619628ctype t = error "Can't happen: Not a valid interface type " ++ show t
620629
621630carith (FCon i)