Subject [IBO] Re: Default Session or Connection in DLL (found it!)
Author lalopus
Hi, for those interested in this things:
the problem was that I was trying to Release a TForm on the DllProc
when Reason was DLL_PROCESS_DETACH. Apparently this caused a leak
because the Release method returns before the Form is actually
destroyed (maybe the dll was freed before the form??).

Thanks to all again
Eduardo

--- In IBObjects@yahoogroups.com, "lalopus" <eduardo@p...> wrote:
> hi to all, after peeling off all IBO components I still get the
> access violation, so I'll look somewhere else now.
> Thanks to all
>
> Eduardo
>
> --- In IBObjects@yahoogroups.com, "lalopus" <eduardo@p...> wrote:
> > Thanks Geoff and Roger for your answers; I am able to use the
> > connection now, but I'm still having problems when calling
> > FreeLibrary(MyDllHandle). I don't know what else to do, the flow
> I'm
> > using is something like:
> > EXE: On Create logs in the DB and loads DLL
> > EXE: Button that calls DLL procedure passes the dbHandle
> > DLL: Creates MyForm that contains a TIBODatabase, and assigns
its
> > dbHandleShared := EXEConnectiondbHandle
> > DLL: Shows the form, etc... user Closes the form
> > EXE: IBODatabase.Close
> > EXE: FreeLibrary
> > DLL: case DLL_PROCESS_DETACH: DLLDatabase.dbHandleShared := nil
> > DLL: MyForm.Release
> > and then it crashes; as far as my trace could go this happened
> after
> > the IB_Session unit finalization, but I'm not sure about what
> caused
> > the error.
> >
> > Is something missing???
> >
> > TIA
> > Eduardo
> >
> >
> >
> >
> >
> > --- In IBObjects@yahoogroups.com, Geoff Worboys <geoff@t...>
wrote:
> > > > I'm having some problems with this. I could actually "force"
> > > > my connection in the DLL by :
> > >
> > > > IBOQuery1.IB_Session.DefaultSession.DefaultConnection := DB;
> > >
> > > I found the following in the IBO Online FAQ but searching for
> > > the "DLL Issues" keyword.
> > > http://faq.ibobjects.com/scripts/ibofaq.dll
> > >
> > > - - -
> > > 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!
> > > - - -
> > >
> > > HTH
> > >
> > > --
> > > Geoff Worboys
> > > Telesis Computing