Re: Some MM challenge musings

From: John O'Harrow (john_at_elmcrest.demon.co.uk)
Date: 02/11/05


Date: Thu, 10 Feb 2005 23:33:02 -0000


<Dennis Passmore> wrote in message
news:bihn01p8f66l48sbv5usfl33krgd0rvm4s@4ax.com...
>A additional comment on the usage of FastMove.pas
>
> If the main application ( *.exe ) using Fastmove.pas loads a *.dll which
> also uses
> FastMove.pas all is fine except when both the *.exe and the *.dll are
> built with
> "packages" enabled. In this case the second instance of FastMove.pas which
> gets loaded
> from the *.dll takes over the RTL pointers to the remapped first instance
> in the *.exe and
> everything gets very unstable when the dll gets unloaded or the *.exe is
> shutdown.
>
> Something should be done to the Fastmove.pas unit initialization code to
> try and recognise
> that another instance of FastMove.pas has already remapped itself into the
> RTL and not
> doing anything if found.

A very interesting scenario. I'll try to come up with a method of detecting
this situation and, as you suggest, prevent the FastMove patching from
occurring twice (probably by inserting some sort of signature or by checking
the code at the jump destination).

Alternatively, I could restore the old jump destination in the FastMove
units finalization. However, I do not really like this method, because
despite Borland's assurances, it is possible to exit without a units
finalization section being called.

regards,
John.