You never assign to
Form_DLL. This means that when you call
FreeF, you then perform
nil, this does nothing, and the
form still exists.
Fix that by changing
Although, I'd probably change the design completely by removing
Form_DLL altogether. The host app maintains a reference to the
form, on which the call to
Free can be made. In other words,
Form_DLL and implement
Free; // or Destroy
Or even better, use reference counted interfaces on the implementing
object and let
aModuleIntf:=nil take the form down.