@@ -525,7 +525,6 @@ call (FFun name argTypes retType) args =
525 call' (Fun _ h) args FPtr = EPtr <$> (execIO $ callFFI h (retPtr retVoid) (prepArgs args))
525 call' (Fun _ h) args FPtr = EPtr <$> (execIO $ callFFI h (retPtr retVoid) (prepArgs args))
526 call' (Fun _ h) args FUnit = do _ <- execIO $ callFFI h retVoid (prepArgs args)
526 call' (Fun _ h) args FUnit = do _ <- execIO $ callFFI h retVoid (prepArgs args)
527 return $ EP Ref unitCon EErased
527 return $ EP Ref unitCon EErased
528−-- call' (Fun _ h) args other = fail ("Unsupported foreign return type " ++ show other)
531 prepArgs = map prepArg
530 prepArgs = map prepArg
@@ -536,6 +535,8 @@ call (FFun name argTypes retType) args =
536 prepArg (EConstant (B64 i)) = argCLong (fromIntegral i)
535 prepArg (EConstant (B64 i)) = argCLong (fromIntegral i)
537 prepArg (EConstant (Fl f)) = argCDouble (realToFrac f)
536 prepArg (EConstant (Fl f)) = argCDouble (realToFrac f)
538 prepArg (EConstant (Ch c)) = argCChar (castCharToCChar c) -- FIXME - castCharToCChar only safe for first 256 chars
537 prepArg (EConstant (Ch c)) = argCChar (castCharToCChar c) -- FIXME - castCharToCChar only safe for first 256 chars
538+ -- Issue #1720 on the issue tracker.
539+ -- https://github.com/idris-lang/Idris-dev/issues/1720
539 prepArg (EConstant (Str s)) = argString s
540 prepArg (EConstant (Str s)) = argString s
540 prepArg (EPtr p) = argPtr p
541 prepArg (EPtr p) = argPtr p
541 prepArg other = trace ("Could not use " ++ take 100 (show other) ++ " as FFI arg.") undefined
542 prepArg other = trace ("Could not use " ++ take 100 (show other) ++ " as FFI arg.") undefined