|Subject||Re: [IBO] IBO + DB + DLL|
> Question is, how can I allow a Connection stored in a DLL toWhen you go to the IBO website, into the FAQ section and
> be accessed by a Dataset(TIB_Query for example) in an EXE, or
> even another DLL... or vice versa.
highlight (in the keyword list) "DLL Issues" you get:
- - - Start Quote - - -
When trying to share a connection DON'T try to share the
reference to the IB_Connection component. Give every DLL its
own TIB_Connection and simply share the connection handle
between them. Use the dbHandle property and assign the value
from it to the dbHandleShared property of the TIB_Connection
components in the DLL instances. Use whatever means you want
to pass the value, since it is just a simple integer.
One vital point: close the TIB_Connection in the EXE before
you terminate or destroy the DLL calls. Releasing the DLL
resources before you close the TIB_Connection can cause some
messy problems at termination!
- - - End Quote - - -
What I would add to this is... I have had good success using
a central (exe-based) connection shared amongst forms loaded
from dynamically loaded BPL packages (Borland's special DLLs).
But the forms have all been written as a derivation of a common
child class (the base class is part of the main application)
and so it all hangs together quite well.
If you really intend to use DLLs (rather than BPLs), or forms
which are truly independent of the main application, then I
suspect Jason's advice above still stands.