Re: Problem when I'm using libpq PQconnectdb function

From: "Magnus Hagander" <mha(at)sollentuna(dot)net>
To: "Daniel Gerardo Lucero Baylon" <daniel_baylon(at)yahoo(dot)com>, <pgsql-interfaces(at)postgresql(dot)org>
Subject: Re: Problem when I'm using libpq PQconnectdb function
Date: 2004-05-27 08:03:39
Message-ID: 6BCB9D8A16AC4241919521715F4D8BCE34BB25@algol.sollentuna.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

> I compile a C program which uses libpq on Win 32.
>
> When call PQconnectdb function and retrieves error message
> (PQerrorMessage), this is error function returns:
>
> "could not create socket: WSAStartup not yet called
> (0x0000276D/10093)"
>
> I don't know what error means.
>
> I appreciate some help.

If you use the libpqdll importl ibrary (and thus dynamically link to
libpq.dll instead of the static library), it should get called
automatically for you.
Or if you want to use the static library, your program needs to call
WSAStartup() before it uses any libpq functions. This is rqeuired for
all win32 applications that need to use the windwos sockets API.
You can find information about how to call the function at
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock
/winsock/wsastartup_2.asp

//Magnus

Browse pgsql-interfaces by date

  From Date Subject
Next Message L. S. 2004-05-31 17:45:42 libpq and Mac OS X
Previous Message C. Maj 2004-05-24 14:31:21 Re: What has happened to pgaccess?