Thread: libpq.a and Xcode on Mac OS X
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
-------------------------------------------------------------------------------
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@ottawahospital.on.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 pièces jointes, sadresse au destinataire uniquement et pourrait contenir des renseignements confidentiels. Si vous nêtes 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 reçu ce courriel par erreur, veuillez en informer immédiatement lexpéditeur ou le bureau de la Protection des renseignements personnels (info.privee@hopitalottawa.on.ca), puis effacez le courriel ainsi que les pièces jointes et toute autre copie. Merci.
"Peter K. Stys" <pstys@ohri.ca> writes: > ... 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: > Cannot access memory at address 0x0. What conninfo string are you passing? regards, tom lane
On Feb 28, 2007, at 4:47 PM, Peter K. Stys wrote: > 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? These sites might have some useful code and examples: http://www.karppinen.fi/baseten/ http://sourceforge.net/projects/pgsqlformac/ John DeSoi, Ph.D. http://pgedit.com/ Power Tools for PostgreSQL