libpq.a and Xcode on Mac OS X

From: "Peter K(dot) Stys" <pstys(at)ohri(dot)ca>
To: pgsql-interfaces(at)postgresql(dot)org
Subject: libpq.a and Xcode on Mac OS X
Date: 2007-02-28 21:47:08
Message-ID: 8B50CB22-C969-494B-9341-B570513C2638@ohri.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

Hi Folks:

In an attempt to optimize retrieving BLOBs from my PostgreSQL DB I
embarked on a mission to write functions in C to directly access the
back-end using the libpq.a library.

I copied libpq.a from my /usr/local/pgsql/lib/libpq.a installation
into my Xcode project, added all necessary includes and the standard
libpq-fe.h header. My test program builds and runs fine, links
against libpq.a no problem, but upon execution of a simple:

conn = PQconnectdb(conninfo);

(taken from the Postgres examples) the debugger stops in asm code
(presumably the library) with the error:

0x90047960 <+0000> li r0,37
0x90047964 <+0004> sc
0x90047968 <+0008> b 0x90047970 <kill+16>
0x9004796c <+0012> blr
...

Cannot access memory at address 0x0.

I'm using Xcode 2.4 on Mac OS X 10.4.8.

Do you have any ideas or does someone have a simple Xcode project
that would show me how to properly use libpq.a directly from a C
program? Is there an OS X-specific site with examples I could browse
through?

Any advice greatly appreciated. I'm stuck very early in my attempts!

thanks,
Peter.

------------------------------------------------------------------------
-------
Peter K. Stys, MD
Professor of Medicine(Neurology), Senior Scientist
Ottawa Health Research Institute, Div. of Neuroscience
Ottawa Hospital / University of Ottawa
Ontario, CANADA
tel: (613)761-5444
fax: (613)761-5330
http://www.ohri.ca/profiles/stys.asp
------------------------------------------------------------------------
-------

--------------------
Confidentiality Statement - The contents of this e-mail, including its attachment, are intended for the exclusive use of the recipient and may contain confidential or privileged information. If you are not the intended recipient, you are strictly prohibited from reading, using, disclosing, copying, or distributing this e-mail or any of its contents. If you received this e-mail in error, please notify the sender by reply e-mail immediately or the Privacy Office (privacy(at)ottawahospital(dot)on(dot)ca ) and permanently delete this e-mail and its attachments, along with any copies thereof. Thank you.

Avis de confidentialit Ce courriel, y compris ses pices jointes, sadresse au destinataire uniquement et pourrait contenir des renseignements confidentiels. Si vous ntes pas le bon destinataire, il est strictement interdit de lire, dutiliser, de divulguer, de copier ou de diffuser ce courriel ou son contenu, en partie ou en entier. Si vous avez reu ce courriel par erreur, veuillez en informer immdiatement lexpditeur ou le bureau de la Protection des renseignements personnels (info(dot)privee(at)hopitalottawa(dot)on(dot)ca), puis effacez le courriel ainsi que les pices jointes et toute autre copie. Merci.
--------------------

Responses

Browse pgsql-interfaces by date

  From Date Subject
Next Message jing han 2007-03-01 14:59:04 postgres 8.1.8 transaction ID wrapper around related problem
Previous Message Chris Long 2007-02-28 12:05:25 ruby-postgres for Ruby 1.9