Hi Gregory, On Mon, Apr 02, 2007 at 11:57:49AM -0400, Gregory Wright wrote: > > On Apr 1, 2007, at 6:22 PM, Ian Lynagh wrote: > > >Does the 6.6 one work with 6.4.2?: > > > >puts :: String -> IO () > >puts s = do write_rawBuffer 1 (unsafeCoerce# (packCString# s)) > > 0 (fromIntegral (length s)) > > return () > > > >(packCString# come from GHC.Pack) > > Still doesn't work. If I include the definition of write_rawBuffer just > above puts (I can't import GHC.Handle because of the dependency loop) > and dangerously change CInt to Int in the signature (can't import > Foreign.C.Types for the same reason)
Hmm, the foreign import types already look wrong, in both 6.4.2 and the HEAD. For now I recommend changing the definition in include/HsBase.h to only take and return HsInt, and to do the casting on the C side. include/HsBase.h: # ----------------------------- INLINE HsInt __hscore_PrelHandle_write( HsInt fd, HsAddr ptr, HsInt off, HsInt sz ) { return write(fd,(char *)ptr + off, (int)sz); } # ----------------------------- GHC/ForeignPtr.hs: # ----------------------------- import GHC.List import GHC.Pack import GHC.Num puts :: String -> IO () puts s = do write_rawBuffer 1 (unsafeCoerce# (packCString# s)) 0 (length s) return () # ----------------------------- You'll also need to fix the types of the imports in GHC.Handle (there are two of them), and their uses. I successfully built 6.4.2 with these changes. [some hours pass] Actually, HsBase.h contains many type mismatches (I've just pushed a patch to the HEAD), and I think there are more lurking in the base package. I'll probably resume my hunt tomorrow. It's probably not worth debugging further with 6.4 unless we first backport these fixes; it's not particularly unlikely that one of them is the root cause of the bug, after all. Thanks Ian _______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users