#haskell - Sat 14 Apr 2007 between 00:01 and 00:31

sjanssenthat backtrace seems to indicate that you've crashed inside Haskell code, not the C library
sjanssenoh wait, this is way simpler than I thought!
rhz_: the C call isn't happening before you peek off the array
rhz_i thought something like that could be happening
sjanssenyeah, you probably shouldn't be using the 'call' thing
is there another c2hs directive similar to call that generates an IO function?
rhz_: you're forgetting to free some of the stuff you allocate, by the way
rhz_yes true
sjanssenmaybe it should just be 'call' instead of 'call fun'? I really don't know c2hs well
rhz_well that puts the c function call inside the IO monad. That may solve this problem, but I don't want it inside the IO monad.
sjanssenrhz_: it must be, to guarantee sequencing
is solve_gp supposed to be the nice Haskell wrapper around the lower level C function?
rhz_that is basically the idea..
sjanssenokay, then why shouldn't solve_simple_quadprog be in the IO monad?
rhz_good point
sjanssenyou're already doing your marshaling in IO (with an unsafePerformIO around it)
rhz_Changed it as suggested. But still seg faults.. :(
the backtrace is the same.
looks the same
sjanssenso it's no longer "let result = ...", but "result <- ..."?
rhz_it is: result <- {# call solve_simple_quadprog #} matArrArr vecArr (fromIntegral n) xArr
sjanssen: besides if your previous comment about it peeking the array before the c function is called was right it still wouldn't explain why the seg fault. Seg faults don't usually occur from reading from memory, only from writing to memory don't they?
sjanssennah, a seg fault can happen when you read from invalid memory
rhz_If I put print "hello" at the top of the do block then it seg faults before saying hello..
ouch, segfault
actionsorear reads the @where logs
sorearreads the @where logs
rhz_: I just joined
sjanssenrhz_: at the beginning of solve_qp?
rhz_that might mean my ghc has bugs..
dmeador your C is wrong/ish
can i take a look?

Page: 2 9 16 23 30 37 44 51 58 65 72 79