Ticket #2863 (closed merge: fixed)
ghc manual should note FFI non-compliance
|Reported by:||duncan||Owned by:||igloo|
|Type of failure:||Difficulty:||Unknown|
|Test Case:||Blocked By:|
The FFI spec says about hs_init and hs_exit:
In addition to nested calls to hs_init(), the Haskell system may be de-initialised with hs_exit() and be re-initialised with hs_init() at a later point in time.
The GHC manual says in the FFI chapter:
There can be multiple calls to hs_init(), but each one should be matched by one (and only one) call to hs_exit().
and adds in the footnote:
 The outermost hs_exit() will actually de-initialise the system. NOTE that currently GHC's runtime cannot reliably re-initialise after this has happened.
The chapter on known bugs and infelicities should have a section on non-compliance with the FFI part of the spec and should note this limitation, that hs_init() does not necessarily work after the last hs_exit() call.
Of course if this can be fixed then that would be great. If not then perhaps it is better to make it fail obviously rather than possibly working or possibly going horribly wrong.