Repeated hs_init()/hs_exit()

Fergus Henderson fjh at cs.mu.OZ.AU
Tue Jan 28 11:31:50 EST 2003


On 28-Jan-2003, Simon Marlow <simonmar at microsoft.com> wrote:
> I'm implementing the latest hs_init()/hs_exit() interface in GHC, and
> came across an ambiguity or omission in the spec.  We're clear that this
> sequence should be allowed:
> 
>   hs_init(..)
>   hs_init(..)
>   hs_exit()
>   hs_exit()
> 
> but what about
> 
>   hs_init(..)
>   hs_exit()
>   hs_init(..)
>   hs_exit()
> 
> That is, should the Haskell system be able to start itself up again
> after shutting down?  It looks like this is desirable from a modularity
> viewpoint: eg. a C program initialises library A which uses Haskell
> internally, then de-initialises library A, then initialises library B
> which also uses Haskell internally.
> 
> Unfortunately, this is going to require quite a bit of extra work in GHC
> to get right, and it looks like I'm going to have to examine a lot of
> code to make sure it is "double-init-safe".  Thoughts?

FWIW, getting this sort of thing to work properly with the Mercury
implementation would also be quite a lot of work.

Still, I do think that this sort of thing should be supported.
Sometimes standards should serve to advance the state of the art,
rather than merely standardizing on the flaws of existing
implementations, and I think this is one of those time.s

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.



More information about the FFI mailing list