[Haskell-cafe] Compiled program using OpenGL fails to trigger GPU switch on Mac, but works in GHCi

Jason Dagit dagitj at gmail.com
Mon Mar 18 00:58:35 CET 2013


On Sat, Mar 16, 2013 at 6:53 PM, Jesper Särnesjö <sarnesjo at gmail.com> wrote:

>
>
To be clear, I think this isn't really an OpenGL problem, but rather
> one related to FFI or event handling. If anyone could explain to me,
> in general, how and why a call to a foreign function returning IO ()
> might cause different behavior in Haskell than in C, that might help
> me track down the problem.
>

I haven't finished reading your other email, but I can suggest a possible
answer to this query.

Lots of the native GUI libraries attached thread local storage to the
process's initial thread. In GHCi expressions are not evaluated in that
thread (in the default setup). One thing that may be worth investigating is
the difference between ghci behavior when you start with and without
-fno-ghci-sandbox.

The release notes for 7.0.1 said this about that flag:
There is a new -fno-ghci-sandbox flag, which stops GHCi running
computations in a separate thread. In particular, this is useful for GLUT
on OS X, which only works if being run on the main thread.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130317/6f5a957a/attachment.htm>


More information about the Haskell-Cafe mailing list