Linker Confusion.....

View: New views
2 Messages — Rating Filter:   Alert me  

Linker Confusion.....

by Ralf Hasemann :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

I am wirting an application that uses the libpq interface to access  
the PostgreSQL database. My system is Mac OS X.

I have set up my project in Xcode and everything works fine. DB access  
is flawless and very fast. But I often like to dig deeper into things  
to get knowledge on how things work. What confuses me is, when I use  
otool to inspect my executable, I get the information that my app is  
linked against libpq.5.dylib (which is a symlink to libpq.5.1.dylib),  
which is probably the dynamic library that does the work in  
communicating with the database server.
But what I don't understand: In my Xcode project, I have put libpq.a  
(and not libpq.5.dylib!)  into the linked frameworks of my project and  
the project is build against it.
How does the linker know to link against libpq.5.dylib when libpq.a is  
the only lib in my project?

I hope my problem description is not too confusing....

Thank you for any answer and thank you to the PostgreSQL team for the  
great database! ;-)

Best regards,
Ralf

--
Sent via pgsql-interfaces mailing list (pgsql-interfaces@...)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-interfaces

Re: Linker Confusion.....

by Tom Lane-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ralf Hasemann <rhasemann@...> writes:
> How does the linker know to link against libpq.5.dylib when libpq.a is  
> the only lib in my project?

You'd be best advised to ask that on an OSX development list; it's not
particularly a Postgres question, but a question of the behavior of the
development tools on that platform.

Mind you, the above behavior is probably *good*, and I don't recommend
you try to override it.  Statically linked libraries are a real pain
in the neck when it comes time for a software update.  But exactly how
the toolchain you're using finds the dynamic library, I don't know.

                        regards, tom lane

--
Sent via pgsql-interfaces mailing list (pgsql-interfaces@...)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-interfaces