
I have a C function that, for simplicity, has its definition as something like:
void myCFun(FILE *fd);
I have a Handle I've opened in Haskell using openFileEx and would like to pass this to the function. I've tried a bunch of things, the most recent being:
foreign import ccall "myHFile.h myCFun" c__myCFun :: Ptr CInt -> IO () myCFun :: Handle -> IO () myCFun (FileHandle handleMV) = do h__ <- readMVar handleMV ptr <- malloc poke ptr (toCInt $ haFD h__) c__initVars ptr
i've also tried it with just CInt -> IO (), without the ptr, but that doesn't work either. Surely someone has done this at some point...or is it even possible (please say it is)... - Hal -- Hal Daume III | hdaume@isi.edu "Arrest this man, he talks in maths." | www.isi.edu/~hdaume