Hi,

I tried to access C++ iterators from Haskell via the FFI. There are two
example programs attached, in Haskell as well as in C++. Both utilise the
same iterator wrapper example.cpp, but when running the Haskell program it
prints an empty list, where it should print the contents of some vector. The
C++ program meanwhile runs fine though. What does not seem to work is this
part:

bool
finished (std::vector<int>::iterator *begin, std::vector<int>::iterator
*end)
{
    return *begin == *end;
}

In Haskellland, "finished :: Ptr Iterator -> Ptr Iterator -> IO Bool" always
returns IO True. Is this a bug lurking in my program or is it a GHC issue?

Long

Attachment: ffi_and_iterators.tar.gz
Description: GNU Zip compressed data

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to