Repeated hs_init()/hs_exit()

Simon Marlow simonmar at microsoft.com
Tue Jan 28 10:54:10 EST 2003


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?

Cheers,
	Simon




More information about the FFI mailing list