Repeated hs_init()/hs_exit()

Manuel M T Chakravarty chak at cse.unsw.edu.au
Sun Feb 9 20:26:34 EST 2003


Fergus Henderson <fjh at cs.mu.OZ.AU> wrote,

> 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

Ok.  I will add to the spec that complete de-initialisation
followed (re)initialisation should be supported.

Cheers,
Manuel



More information about the FFI mailing list