Re: [Haskell-cafe] Interfacing C++ iterators does not work as expected

Big thanks, that works for me as well. Doesn't GHC check whether a
type is allowed (like CInt,...) or not (like Bool,...)?
2011/5/2 Gábor Lehel
It works if I replace the 'bool' return type of 'finished' with int and CInt on the C++ and Haskell side, respectively, and test for (/= 0).

On 11-05-02 05:31 PM, Huynh Huu Long wrote:
Big thanks, that works for me as well. Doesn't GHC check whether a type is allowed (like CInt,...) or not (like Bool,...)?
No, it doesn't, since version 6.10.1: http://www.haskell.org/ghc/docs/6.10.1/html/users_guide/ffi-ghc.html#glasgow... As it happens, FFI requires translating Haskell Bool from C int (unlikely to be 1 byte), while GCC translates C++ bool to 1 byte. At a suitable moon phase and planet alignment (or data alignment), mixing up an int with a byte will be funny.
participants (2)
-
Albert Y. C. Lai
-
Huynh Huu Long