Brano wrote:
> ... so I just want to call one function from postgres library. According
> to the nm command (nm /usr/lib/libpq.a) the object (which contains
> PQinitSSL() function contains also number of SSL functions e.g. BIO_free,
> BIO_new_mem_buf etc. When I'm trying to compile test program with command:
libpq.a contains references to those functions, not the functions.
> gcc -o test test.c -lpq
This probably links agains the .so, not the static lib (hint : ldd binary)
> everything is OK, but when I'm trying to compile the same code with the
> libpq library in the local directory, I've got a lot of undefined
> reference messages on SSL functions
>
> cp /usr/lib/libpq.a .
> gcc -o test test.c -L. -lpq
>
> So, how it is possible, that the first command works fine and the
> second not ?
Because the first one uses the .so (which also contains the
dependencies), while the second one uses the .a, which only contains
references to the SSL functions, not where to get them.
I'm trying to compile it with the same library in both
> cases. I know, that libpq.a library does not contains libcrypto.a
> library. Are in the libpq.a (and generally any other) library references
> to the other libraries ? And how can I determine those references ? Is it
> possible with nm command ? Many thanks for the help.
See the nm manual for that. The U symbol type is most interesting in
this case.
Igmar
|