> I'm not sure about Windows DLLs, but shared libraries under Unix
> require compiling the code position-independant, which involves
> allocating a register to point to the look-up tables. GHC makes
> pretty heavy use of registers, and the x86 is already short. The
> chances are that doing this right now would impose a significant
> performance hit.
> Simon Marlow [EMAIL PROTECTED]
Fortunately Windows does not require position independent code for its DLLs
- indeed, under NT the constraints on a DLL are very few indeed, and just
about any library can be routinely converted to a DLL without code changes.
The only complicated issues are initialisation and termination (you may
need to catch the events which occur when a DLL is loaded and unloaded) and
sharing data between multiple instances of a DLL (which is possible but
messy).
I think that Windows uses a relocating loader to load DLLs, but I think
you also link a DLL to reside in a preferred location - so if the preferred
location is free, no relocation is needed when it is loaded.