ghc rts selection and third party libraries

Simon Marlow marlowsd at
Mon Feb 1 07:00:26 EST 2010

On 01/02/2010 05:33, John Lask wrote:

> I hope someone can provide some guidance on how I can solve a certain
> problem.
> I have a library that taps into the ghc c rts: specifically when the rts
> is single threaded I am pumping events in via: stg_pending_events, when
> the threaded rts is used I use sendIOManagerEvent.

These are RTS internal APIs, and could change under your feet.  What is 
it you're trying to do exactly?

> i.e. I have two versions of the library with the same api. The problem
> with this is that either library is only good for one context: either
> threaded rts or not, and the user needs to select the appropriate
> library to use depending on the use context.
> What I want to be able to do is to have ghc automatically select the
> compiled library version to link in depending on the which rts option is
> selected: "-thread" or not

Library code is generally supposed to be independent of -threaded; 
sometimes we do this by checking at runtime using rtsSupportsBoundThreads().


More information about the Glasgow-haskell-users mailing list