RE: Updates to FFI spec: hs_init() & friends
So, my proposal is to
* permit multiple calls to hs_init() and hs_exit() (the number of calls must match of course),
* command line arguments specified in the second and following invocations to hs_init() are ignored, and
* both arguments to hs_init() may be NULL (to indicate the absence of arguments).
The second point is necessary to keep the implementation on the Haskell side reasonably straight forward.
I think, we also need to say something about the timing of hs_set_argv() and calling getProgName and getArgs. I'd say, if hs_set_argv() is used at all, it must be before the first call to getProgName and getArgs (otherwise, the system behaviour is undefined).
Objections?
Fine by me.
Perhaps on GHC you should be required to "register" the top module in your program first, maybe something like
registerModule(__stginit_Main);
that way you can register multiple modules (which isn't possible at the moment, you have to have another module which imports all the others).
So, registerModule() would be a GHC-specific extension to the FFI API?
Well, more of a restriction than an extension :-) But yes, that would be GHC-only. Cheers, Simon
participants (1)
-
Simon Marlow