Databases, DLL's, DPL's please help

I have posted this question in the past and so have many others
but I have not had a response to my problem.  I am sure that there
are alot of people out there who would like to know the solution.

Okay the problem is this:
I have a DLL that is holding all the common dialogs for my application.
Most of these DLL's are dataaware.  When I call one of the functions
that show a dialog I pass it the handle to the application (so that they
can be shown modally) and the handle to the database (so that they
use the same connection) that all works fine.  Inside the DLL there
are global declarations to the dialogs that are contained within so
that the first time that a function is called it creates the dialog that is
required, then subsequent calls don't need to (seeing how it takes
a while to create the tables on the form). Up to this point all is still
working nicely.  The problem comes when I try to close the application
then I get some nice garbage returned, and finally the application will
continue to crash until I reboot.

Oh yeah I free the forms in the finalization section of the DLL. (But it
never gets there unless I use solution 2 below)

I have two solutions to this problem, but I am looking for the holy
grail of solutions as I don't think the solutions that I have seen explain
to me WHY it is happening:
1. Build the DLL and applications with DPL's
2. Have a clean up function in the DLL that frees all the forms
Both of these work, but I would like to know the third solution.

So if anybody out there has the third solution, please, oh please let
us all know.


P.S. I have also tried to free the forms on proccess detach for the DLL,
unsuccesfully (sniff)

And some more information, I have another DLL that only contains
a datamodule with a TDatabase and TStoredProc on it to give me
the next table id.  And I use it in the same way...guess what it works