17 Jun 2012 17:11
Segmentation fault/access violation in generated code
Bas van Dijk <v.dijk.bas <at> gmail.com>
2012-06-17 15:11:35 GMT
2012-06-17 15:11:35 GMT
Hello, I'm trying to solve #5254 (http://hackage.haskell.org/trac/ghc/ticket/5254). The issue can be isolated to the following short program which only uses bindings-libusb (http://hackage.haskell.org/packages/archive/bindings-libusb/1.4.4.1/doc/html/Bindings-Libusb-InitializationDeinitialization.html): -------------------------------------------------- module Main where import Foreign import qualified Foreign.Concurrent as FC import Control.Concurrent import Bindings.Libusb.InitializationDeinitialization main :: IO () main = do ctxPtr <- alloca $ \ctxPtrPtr -> do _ <- c'libusb_init ctxPtrPtr peek ctxPtrPtr fp <- newForeignPtr p'libusb_exit ctxPtr -- fp <- FC.newForeignPtr ctxPtr $ c'libusb_exit ctxPtr threadDelay 3000000 print $ fp == fp -------------------------------------------------- When I run this program on Windows I get the following error after 3 seconds:(Continue reading)
RSS Feed