[Haskell-cafe] Interfacing C++ iterators does not work as expected
Huynh Huu Long
long.upcase at googlemail.com
Mon May 2 21:35:51 CEST 2011
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20110502/0253f5d8/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ffi_and_iterators.tar.gz
Type: application/x-gzip
Size: 1097 bytes
Desc: not available
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20110502/0253f5d8/attachment.bin>
More information about the Haskell-Cafe
mailing list