Subject Re: [IBO] Sharing a connection between an exe and a DLL
Author Robert martin
Hi

I don't know. We have a threaded exe (yes each thread has its own
ib_Connection) and sometimes these threads can call dlls passing the
DBHandle. We thought it was all ok but one customer is having lots of
AVs and the dlls have logged AVs internally at random points in the
code. We know out threading / Db access works well and most clients
have no problems. However this client is one of the few that uses the
dll functionality we are pretty sure that whatever is causing the
problem is centered around the dll.


Rob Martin
Software Engineer

phone +64 03 377 0495
fax +64 03 377 0496
web www.chreos.com

Wild Software Ltd



Markus Ostenried wrote:
> At 09:45 Thursday, 18.05.2006 +1200, Robert martin wrote:
>
>> Hi
>>
>> I have had a search back through my emails and found this gem ....
>>
>> Quote
>>
>> Jason has given Following Point in his FAQ
>>
>> 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!
>> (Jason Wharton)
>>
>> End Quote
>>
>>
>> Which is interesting because we have a client who is experiencing
>> strange problems with our app and a custom dll we have written for
>> them. It seems the last bit might be catching us out. We are freeing
>> the dll before exes TIB_connection is closed. This is done for
>> performance reasons (among other issues).
>>
>> Questions
>>
>> 1) Does this still apply to the latest release of IBObjects?
>> 2) Are there any work arounds if it does apply?
>>
>> I am pretty sure this is causing us some fairly major problems.
>>
>
> Hi,
>
> I know of this. But I'm sharing the reference to a TIB_Connection
> among one exe and 15 dlls for about 4 years now. I haven't discovered
> any problems so far. Do I need to worry?
>
> Regards,
> Markus
>
>
>
>
> ___________________________________________________________________________
> IB Objects - direct, complete, custom connectivity to Firebird or InterBase
> without the need for BDE, ODBC or any other layer.
> ___________________________________________________________________________
> http://www.ibobjects.com - your IBO community resource for Tech Info papers,
> keyword-searchable FAQ, community code contributions and more !
> Yahoo! Groups Links
>
>
>
>
>
>
>
>
>