Re: libpq on windows

From: Gustavo Lopes <contratempo(at)gmail(dot)com>
To: pgsql-interfaces(at)postgresql(dot)org
Subject: Re: libpq on windows
Date: 2005-05-19 23:52:47
Message-ID: 2b5c484b05051916527e953873@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

psql is too complex for me to analyze and I believe it's multithreaded
but anyway Ic ouldn't fathom anything substantially different when the
function PQsetdbLogin() is called (file startup.c).
It would probably be better to say what I've doing because it's
possible it's a mistake in some elementary aspect I haven't grasped.
Here is a sample program:

#include <libpq-fe.h>
#pragma comment(lib,"libpq.lib")
int main(void) {
PGconn *conn;
conn = PQconnectdb("host=localhost");
return 0;
}

The import library was created with "impdef -f -a libpq.lib libpq.dll"
(borland) and impdef/implib (vc++).
This program works only when postgresql is running.

Thanks in advance

Gustavo Lopes

On 19/05/05, John DeSoi <desoi(at)pgedit(dot)com> wrote:
>
> On May 19, 2005, at 9:52 AM, Gustavo Lopes wrote:
>
> > The problem can be very easily reproduced by creating a C program
> > which calls PQconnectdb with a host parameter that points to a machine
> > that is not running postgres.
> > Running the same program under linux (although I used older versions
> > of the interface and the server) does not cause any problems.
>
> Try comparing what you are doing in this case to the psql source. It
> uses libpq and I run tests regularly that try connecting to an invalid
> server. I have not seen any problems.
>
>
> John DeSoi, Ph.D.
> http://pgedit.com/
> Power Tools for PostgreSQL
>
>

Attachment Content-Type Size
libpq.rar application/octet-stream 7.0 KB

In response to

Browse pgsql-interfaces by date

  From Date Subject
Next Message LinuxFaq 2005-05-20 04:14:36 libpgtcl.dll + SSL
Previous Message Peter Manchev 2005-05-19 18:47:44 Re: postgresql JSP Tags