Updates to FFI spec

Alastair Reid alastair at reid-consulting-uk.ltd.uk
Tue Aug 13 06:55:49 EDT 2002

> At the moment, there are two kinds of initialisation done for each
> module:

Both ELF and DLLs on Windows provide a way of specifying initializers.

Or, easier yet, since the user is already using the hs_init function,
you could use that.  The way you'd do that in ELF is to define a
special section 'hs_initializers'.  Every module would contain a
single object in that section: the address of the initializer.  (In
gcc you do this by attaching an attribute to the variable.  In asm it
is even easier since assemblers directly expose sections to the
programmer.)  The linker will do what it does with all sections:
concatenate the pieces from all object files.  hs_init would treat the
section as an array of function pointers.  I'm sure that the Windows
linker must have a similar mechanism - the main trick is figuring out
what name to give the sections.


More information about the FFI mailing list