[unixODBC-support] ODBC ODBCPSQL libraries

Martin J. Evans martin at easysoft.com
Thu Aug 12 18:14:59 BST 2004


On 12-Aug-2004 Shaun Savage wrote:
> Hi
> 
> I traced through the loading of the libraries.  before I do  SQLConnect 
> the odbcpsql library is not accessable.  After I execute SQLConnect the 
> odbcpsql library is loaded.
> 
> Now when I execute SQLExecDirect() the loader ld-linux.so.2 does a 
> string compair with the name SQLExecDirect and the libraries that are 
> loaded.
> 
> Because odbcpsql is loaded after odbc library the search finds the 
> SQLExecDirect of the odbcpsql before SQLExecDirect in odbc.
> 
> This problem only happens under Mozilla.  When I do a standalone test it 
> works.
> 
> shaun

This is most likely down to the dlopen flags Mozilla uses to dlopen libodbc.so.
It should be using something like RTLD_GROUP or you will get the bahavior you
describe.

The driver manager dlopens the postgres driver with the correct flags and calls
dlsym for all the ODBC APIs in the driver. From then on the DM calls using the
addresses that come back from dlsym. Mozilla needs to do the same.

Basically, you need to look at how mozilla dlopens libodbc.so.

Martin 
--
Martin J. Evans
Easysoft Ltd, UK
Development


> haun Savage wrote:
>  > Hi
>  >
>  > I am trying to development a Mozilla XPCOM module for Linux that uses
>  > unixODBC.
>  > When I run my module in stand alone mode it works but when I use it
>  > under Mozilla it seg faults.
>  >
>  > The command  I it seg faults on is SQLExecDirect.   In standalone mode
>  > the library that is used is libodbc.so  I have traced it into the Driver
>  > manager code before it pops into odbcpsql. In mozilla it links into
>  > odbcpsql right away.  It then jumps into PG_SQLExecDirect line 207
>  > Drivers/PostgreSQL/execute.c .  It segfaults at checking statement is
>  > read only, line 189.
>  >
>  > Why does a different library get dynamicly linked in?
>  > I pass it the correct arguments why does is segfault deep in the code?
>  >
>  > shaun
>  >
> 
> Hi, have you any idea why it links directly into odbcpsql, is there any
> reason ? Normally you would link to libodbc.so and go from there.
> 
> -- 
> Nick
> _______________________________________________
> unixODBC-support mailing list
> unixODBC-support at mail.easysoft.com
> http://mail.easysoft.com/mailman/listinfo/unixodbc-support




More information about the unixODBC-support mailing list