Updates to FFI spec: hs_init() & friends

Simon Marlow simonmar at microsoft.com
Tue Sep 10 05:01:18 EDT 2002


> 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



More information about the FFI mailing list