pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
libpq.a and Xcode on Mac OS X
3+ messages / 3 participants
[nested] [flat]

* libpq.a and Xcode on Mac OS X
@ 2007-02-28 21:47  Peter K. Stys <pstys@ohri.ca>
  0 siblings, 2 replies; 3+ messages in thread

From: Peter K. Stys @ 2007-02-28 21:47 UTC (permalink / raw)
  To: 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@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, s’adresse au destinataire uniquement et pourrait contenir des renseignements confidentiels. Si vous n’êtes pas le bon destinataire, il est strictement interdit de lire, d’utiliser, 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 l’expé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.
--------------------

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: libpq.a and Xcode on Mac OS X
@ 2007-03-01 19:21  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Peter K. Stys <pstys@ohri.ca>
  1 sibling, 0 replies; 3+ messages in thread

From: Tom Lane @ 2007-03-01 19:21 UTC (permalink / raw)
  To: Peter K. Stys <pstys@ohri.ca>; +Cc: pgsql-interfaces

"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



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: libpq.a and Xcode on Mac OS X
@ 2007-03-01 21:09  John DeSoi <desoi@pgedit.com>
  parent: Peter K. Stys <pstys@ohri.ca>
  1 sibling, 0 replies; 3+ messages in thread

From: John DeSoi @ 2007-03-01 21:09 UTC (permalink / raw)
  To: Peter K. Stys <pstys@ohri.ca>; +Cc: pgsql-interfaces

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




^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2007-03-01 21:09 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-02-28 21:47 libpq.a and Xcode on Mac OS X Peter K. Stys <pstys@ohri.ca>
2007-03-01 19:21 ` Tom Lane <tgl@sss.pgh.pa.us>
2007-03-01 21:09 ` John DeSoi <desoi@pgedit.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox