mirror of
https://github.com/postgres/postgres.git
synced 2025-04-22 23:02:54 +03:00
Hello!
Through some minor changes, I have been able to compile the libpq client libraries on the Win32 platform. Since the libpq communications part has been rewritten, this has become much easier. Enclosed is a patch that will allow at least Microsoft Visual C++ to compile libpq into both a static and a dynamic library. I will take a look at porting the psql frontend as well, but I figured it was a good idea to send in these patches first - so no major changes are done to the files before it gets applied (if it does). Regards, Magnus Hagander
This commit is contained in:
parent
d5283ccd3e
commit
c765b4b052
@ -6,7 +6,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) 1995, Regents of the University of California
|
* Copyright (c) 1995, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $Id: postgres.h,v 1.16 1998/04/26 04:08:18 momjian Exp $
|
* $Id: postgres.h,v 1.17 1998/07/03 04:24:10 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -37,7 +37,9 @@
|
|||||||
#define POSTGRES_H
|
#define POSTGRES_H
|
||||||
|
|
||||||
#include "postgres_ext.h"
|
#include "postgres_ext.h"
|
||||||
|
#ifndef WIN32
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#endif
|
||||||
#include "c.h"
|
#include "c.h"
|
||||||
#include "utils/elog.h"
|
#include "utils/elog.h"
|
||||||
#include "utils/palloc.h"
|
#include "utils/palloc.h"
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-auth.c,v 1.17 1998/06/15 19:30:22 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-auth.c,v 1.18 1998/07/03 04:24:11 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -24,6 +24,9 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
#ifdef WIN32
|
||||||
|
#include "win32.h"
|
||||||
|
#else
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/param.h> /* for MAXHOSTNAMELEN on most */
|
#include <sys/param.h> /* for MAXHOSTNAMELEN on most */
|
||||||
@ -33,6 +36,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
|
#endif /* WIN32 */
|
||||||
|
|
||||||
#include "postgres.h"
|
#include "postgres.h"
|
||||||
|
|
||||||
@ -600,10 +604,18 @@ fe_getauthname(char *PQerrormsg)
|
|||||||
#endif
|
#endif
|
||||||
case STARTUP_MSG:
|
case STARTUP_MSG:
|
||||||
{
|
{
|
||||||
|
#ifdef WIN32
|
||||||
|
char username[128];
|
||||||
|
DWORD namesize = sizeof(username) - 1;
|
||||||
|
|
||||||
|
if (GetUserName(username,&namesize))
|
||||||
|
name = username;
|
||||||
|
#else
|
||||||
struct passwd *pw = getpwuid(geteuid());
|
struct passwd *pw = getpwuid(geteuid());
|
||||||
|
|
||||||
if (pw)
|
if (pw)
|
||||||
name = pw->pw_name;
|
name = pw->pw_name;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.69 1998/06/21 16:39:11 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.70 1998/07/03 04:24:12 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -407,6 +407,7 @@ connectDB(PGconn *conn)
|
|||||||
family,
|
family,
|
||||||
len;
|
len;
|
||||||
char beresp;
|
char beresp;
|
||||||
|
int on = 1;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize the startup packet.
|
* Initialize the startup packet.
|
||||||
@ -456,8 +457,11 @@ connectDB(PGconn *conn)
|
|||||||
conn->raddr.in.sin_port = htons((unsigned short) (portno));
|
conn->raddr.in.sin_port = htons((unsigned short) (portno));
|
||||||
len = sizeof(struct sockaddr_in);
|
len = sizeof(struct sockaddr_in);
|
||||||
}
|
}
|
||||||
|
#ifndef WIN32
|
||||||
else
|
else
|
||||||
len = UNIXSOCK_PATH(conn->raddr.un, portno);
|
len = UNIXSOCK_PATH(conn->raddr.un, portno);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* Connect to the server */
|
/* Connect to the server */
|
||||||
if ((conn->sock = socket(family, SOCK_STREAM, 0)) < 0)
|
if ((conn->sock = socket(family, SOCK_STREAM, 0)) < 0)
|
||||||
@ -482,7 +486,11 @@ connectDB(PGconn *conn)
|
|||||||
* We need nonblocking I/O, and we don't want delay of outgoing data.
|
* We need nonblocking I/O, and we don't want delay of outgoing data.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef WIN32
|
||||||
if (fcntl(conn->sock, F_SETFL, O_NONBLOCK) < 0)
|
if (fcntl(conn->sock, F_SETFL, O_NONBLOCK) < 0)
|
||||||
|
#else
|
||||||
|
if (ioctlsocket(conn->sock,FIONBIO, &on) != 0)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
(void) sprintf(conn->errorMessage,
|
(void) sprintf(conn->errorMessage,
|
||||||
"connectDB() -- fcntl() failed: errno=%d\n%s\n",
|
"connectDB() -- fcntl() failed: errno=%d\n%s\n",
|
||||||
@ -493,7 +501,6 @@ connectDB(PGconn *conn)
|
|||||||
if (family == AF_INET)
|
if (family == AF_INET)
|
||||||
{
|
{
|
||||||
struct protoent *pe;
|
struct protoent *pe;
|
||||||
int on = 1;
|
|
||||||
|
|
||||||
pe = getprotobyname("TCP");
|
pe = getprotobyname("TCP");
|
||||||
if (pe == NULL)
|
if (pe == NULL)
|
||||||
@ -503,11 +510,18 @@ connectDB(PGconn *conn)
|
|||||||
goto connect_errReturn;
|
goto connect_errReturn;
|
||||||
}
|
}
|
||||||
if (setsockopt(conn->sock, pe->p_proto, TCP_NODELAY,
|
if (setsockopt(conn->sock, pe->p_proto, TCP_NODELAY,
|
||||||
&on, sizeof(on)) < 0)
|
#ifdef WIN32
|
||||||
|
(char *)
|
||||||
|
#endif
|
||||||
|
&on,
|
||||||
|
sizeof(on)) < 0)
|
||||||
{
|
{
|
||||||
(void) sprintf(conn->errorMessage,
|
(void) sprintf(conn->errorMessage,
|
||||||
"connectDB() -- setsockopt failed: errno=%d\n%s\n",
|
"connectDB() -- setsockopt failed: errno=%d\n%s\n",
|
||||||
errno, strerror(errno));
|
errno, strerror(errno));
|
||||||
|
#ifdef WIN32
|
||||||
|
printf("Winsock error: %i\n",WSAGetLastError());
|
||||||
|
#endif
|
||||||
goto connect_errReturn;
|
goto connect_errReturn;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -666,7 +680,11 @@ connectDB(PGconn *conn)
|
|||||||
connect_errReturn:
|
connect_errReturn:
|
||||||
if (conn->sock >= 0)
|
if (conn->sock >= 0)
|
||||||
{
|
{
|
||||||
|
#ifdef WIN32
|
||||||
|
closesocket(conn->sock);
|
||||||
|
#else
|
||||||
close(conn->sock);
|
close(conn->sock);
|
||||||
|
#endif
|
||||||
conn->sock = -1;
|
conn->sock = -1;
|
||||||
}
|
}
|
||||||
return CONNECTION_BAD;
|
return CONNECTION_BAD;
|
||||||
@ -742,7 +760,11 @@ freePGconn(PGconn *conn)
|
|||||||
return;
|
return;
|
||||||
PQclearAsyncResult(conn); /* deallocate result and curTuple */
|
PQclearAsyncResult(conn); /* deallocate result and curTuple */
|
||||||
if (conn->sock >= 0)
|
if (conn->sock >= 0)
|
||||||
close(conn->sock); /* shouldn't happen, but... */
|
#ifdef WIN32
|
||||||
|
closesocket(conn->sock);
|
||||||
|
#else
|
||||||
|
close(conn->sock);
|
||||||
|
#endif
|
||||||
if (conn->pghost)
|
if (conn->pghost)
|
||||||
free(conn->pghost);
|
free(conn->pghost);
|
||||||
if (conn->pgport)
|
if (conn->pgport)
|
||||||
@ -783,6 +805,7 @@ closePGconn(PGconn *conn)
|
|||||||
* If connection is already gone, that's cool. No reason for kernel
|
* If connection is already gone, that's cool. No reason for kernel
|
||||||
* to kill us when we try to write to it. So ignore SIGPIPE signals.
|
* to kill us when we try to write to it. So ignore SIGPIPE signals.
|
||||||
*/
|
*/
|
||||||
|
#ifndef WIN32
|
||||||
#if defined(USE_POSIX_SIGNALS)
|
#if defined(USE_POSIX_SIGNALS)
|
||||||
struct sigaction ignore_action;
|
struct sigaction ignore_action;
|
||||||
struct sigaction oldaction;
|
struct sigaction oldaction;
|
||||||
@ -806,13 +829,18 @@ closePGconn(PGconn *conn)
|
|||||||
|
|
||||||
signal(SIGPIPE, oldsignal);
|
signal(SIGPIPE, oldsignal);
|
||||||
#endif
|
#endif
|
||||||
|
#endif /* Win32 uses no signals at all */
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Close the connection, reset all transient state, flush I/O buffers.
|
* Close the connection, reset all transient state, flush I/O buffers.
|
||||||
*/
|
*/
|
||||||
if (conn->sock >= 0)
|
if (conn->sock >= 0)
|
||||||
|
#ifdef WIN32
|
||||||
|
closesocket(conn->sock);
|
||||||
|
#else
|
||||||
close(conn->sock);
|
close(conn->sock);
|
||||||
|
#endif
|
||||||
conn->sock = -1;
|
conn->sock = -1;
|
||||||
conn->status = CONNECTION_BAD; /* Well, not really _bad_ - just
|
conn->status = CONNECTION_BAD; /* Well, not really _bad_ - just
|
||||||
* absent */
|
* absent */
|
||||||
|
@ -7,10 +7,13 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.54 1998/06/16 07:29:48 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.55 1998/07/03 04:24:13 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
#ifdef WIN32
|
||||||
|
#include "win32.h"
|
||||||
|
#endif
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -7,11 +7,16 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-lobj.c,v 1.13 1998/06/15 19:30:26 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-lobj.c,v 1.14 1998/07/03 04:24:14 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
#ifdef WIN32
|
||||||
|
#include "win32.h"
|
||||||
|
#include <io.h>
|
||||||
|
#else
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-misc.c,v 1.15 1998/06/15 19:30:26 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-misc.c,v 1.16 1998/07/03 04:24:14 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -34,10 +34,14 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#ifdef WIN32
|
||||||
|
#include "win32.h"
|
||||||
|
#else
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#if !defined(NO_UNISTD_H)
|
#if !defined(NO_UNISTD_H)
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
#endif /* WIN32 */
|
||||||
#include <sys/types.h> /* for fd_set stuff */
|
#include <sys/types.h> /* for fd_set stuff */
|
||||||
#ifdef HAVE_SYS_SELECT_H
|
#ifdef HAVE_SYS_SELECT_H
|
||||||
#include <sys/select.h>
|
#include <sys/select.h>
|
||||||
@ -412,7 +416,11 @@ tryAgain2:
|
|||||||
" before or while processing the request.\n");
|
" before or while processing the request.\n");
|
||||||
conn->status = CONNECTION_BAD; /* No more connection to
|
conn->status = CONNECTION_BAD; /* No more connection to
|
||||||
* backend */
|
* backend */
|
||||||
|
#ifdef WIN32
|
||||||
|
closesocket(conn->sock);
|
||||||
|
#else
|
||||||
close(conn->sock);
|
close(conn->sock);
|
||||||
|
#endif
|
||||||
conn->sock = -1;
|
conn->sock = -1;
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -9,24 +9,31 @@
|
|||||||
* didn't really belong there.
|
* didn't really belong there.
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-print.c,v 1.5 1998/06/16 07:29:49 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-print.c,v 1.6 1998/07/03 04:24:15 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
#ifdef WIN32
|
||||||
|
#include "win32.h"
|
||||||
|
#endif
|
||||||
#include <postgres.h>
|
#include <postgres.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#ifndef WIN32
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
|
#endif
|
||||||
#include "libpq/pqsignal.h"
|
#include "libpq/pqsignal.h"
|
||||||
#include "libpq-fe.h"
|
#include "libpq-fe.h"
|
||||||
|
#ifndef WIN32
|
||||||
#ifndef HAVE_TERMIOS_H
|
#ifndef HAVE_TERMIOS_H
|
||||||
#include <sys/termios.h>
|
#include <sys/termios.h>
|
||||||
#else
|
#else
|
||||||
#include <termios.h>
|
#include <termios.h>
|
||||||
#endif
|
#endif
|
||||||
|
#endif /* WIN32 */
|
||||||
|
|
||||||
#ifdef MB
|
#ifdef MB
|
||||||
#include "regex/pg_wchar.h"
|
#include "regex/pg_wchar.h"
|
||||||
@ -143,9 +150,13 @@ PQprint(FILE *fout,
|
|||||||
|
|
||||||
if (fout == NULL)
|
if (fout == NULL)
|
||||||
fout = stdout;
|
fout = stdout;
|
||||||
if (po->pager && fout == stdout &&
|
if (po->pager && fout == stdout
|
||||||
|
#ifndef WIN32
|
||||||
|
&&
|
||||||
isatty(fileno(stdin)) &&
|
isatty(fileno(stdin)) &&
|
||||||
isatty(fileno(stdout)))
|
isatty(fileno(stdout))
|
||||||
|
#endif
|
||||||
|
)
|
||||||
{
|
{
|
||||||
/* try to pipe to the pager program if possible */
|
/* try to pipe to the pager program if possible */
|
||||||
#ifdef TIOCGWINSZ
|
#ifdef TIOCGWINSZ
|
||||||
@ -174,11 +185,17 @@ PQprint(FILE *fout,
|
|||||||
- (po->header != 0) * 2 /* row count and newline */
|
- (po->header != 0) * 2 /* row count and newline */
|
||||||
)))
|
)))
|
||||||
{
|
{
|
||||||
|
#ifdef WIN32
|
||||||
|
fout = _popen(pagerenv, "w");
|
||||||
|
#else
|
||||||
fout = popen(pagerenv, "w");
|
fout = popen(pagerenv, "w");
|
||||||
|
#endif
|
||||||
if (fout)
|
if (fout)
|
||||||
{
|
{
|
||||||
usePipe = 1;
|
usePipe = 1;
|
||||||
|
#ifndef WIN32
|
||||||
pqsignal(SIGPIPE, SIG_IGN);
|
pqsignal(SIGPIPE, SIG_IGN);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
fout = stdout;
|
fout = stdout;
|
||||||
@ -289,8 +306,12 @@ PQprint(FILE *fout,
|
|||||||
free(fieldNames);
|
free(fieldNames);
|
||||||
if (usePipe)
|
if (usePipe)
|
||||||
{
|
{
|
||||||
|
#ifdef WIN32
|
||||||
|
_pclose(fout);
|
||||||
|
#else
|
||||||
pclose(fout);
|
pclose(fout);
|
||||||
pqsignal(SIGPIPE, SIG_DFL);
|
pqsignal(SIGPIPE, SIG_DFL);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
if (po->html3 && !po->expanded)
|
if (po->html3 && !po->expanded)
|
||||||
fputs("</table>\n", fout);
|
fputs("</table>\n", fout);
|
||||||
|
6
src/interfaces/libpq/libpqdll.c
Normal file
6
src/interfaces/libpq/libpqdll.c
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
#include <windows.h>
|
||||||
|
BOOL WINAPI DllMain( HINSTANCE hinstDLL, DWORD fdwReason,
|
||||||
|
LPVOID lpReserved ){
|
||||||
|
return (TRUE);
|
||||||
|
}
|
73
src/interfaces/libpq/libpqdll.def
Normal file
73
src/interfaces/libpq/libpqdll.def
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
LIBRARY LIBPQ
|
||||||
|
DESCRIPTION "Postgres Client Access Library"
|
||||||
|
EXPORTS
|
||||||
|
PQconnectdb @ 1
|
||||||
|
PQconndefaults @ 2
|
||||||
|
PQsetdbLogin @ 3
|
||||||
|
PQfinish @ 4
|
||||||
|
PQreset @ 5
|
||||||
|
PQdb @ 6
|
||||||
|
PQuser @ 7
|
||||||
|
PQhost @ 8
|
||||||
|
PQoptions @ 9
|
||||||
|
PQport @ 10
|
||||||
|
PQtty @ 11
|
||||||
|
PQstatus @ 12
|
||||||
|
PQerrorMessage @ 13
|
||||||
|
PQsocket @ 14
|
||||||
|
PQtrace @ 15
|
||||||
|
PQuntrace @ 16
|
||||||
|
PQexec @ 17
|
||||||
|
PQnotifies @ 18
|
||||||
|
PQsendQuery @ 19
|
||||||
|
PQgetResult @ 20
|
||||||
|
PQisBusy @ 21
|
||||||
|
PQconsumeInput @ 22
|
||||||
|
PQrequestCancel @ 23
|
||||||
|
PQgetline @ 24
|
||||||
|
PQputline @ 25
|
||||||
|
PQendcopy @ 26
|
||||||
|
PQfn @ 27
|
||||||
|
PQclearAsyncResult @ 28
|
||||||
|
PQresultStatus @ 29
|
||||||
|
PQntuples @ 30
|
||||||
|
PQnfields @ 31
|
||||||
|
PQfname @ 32
|
||||||
|
PQfnumber @ 33
|
||||||
|
PQftype @ 34
|
||||||
|
PQfsize @ 35
|
||||||
|
PQfmod @ 36
|
||||||
|
PQcmdStatus @ 37
|
||||||
|
PQoidStatus @ 38
|
||||||
|
PQcmdTuples @ 39
|
||||||
|
PQgetvalue @ 40
|
||||||
|
PQgetlength @ 41
|
||||||
|
PQgetisnull @ 42
|
||||||
|
PQclear @ 43
|
||||||
|
PQprint @ 44
|
||||||
|
PQdisplayTuples @ 45
|
||||||
|
PQprintTuples @ 46
|
||||||
|
fe_getauthsvc @ 47
|
||||||
|
fe_setauthsvc @ 48
|
||||||
|
fe_getauthname @ 49
|
||||||
|
pqGetc @ 50
|
||||||
|
pqGets @ 51
|
||||||
|
pqPuts @ 52
|
||||||
|
pqGetnchar @ 53
|
||||||
|
pqPutnchar @ 54
|
||||||
|
pqGetInt @ 55
|
||||||
|
pqPutInt @ 56
|
||||||
|
pqReadData @ 57
|
||||||
|
pqFlush @ 58
|
||||||
|
pqWait @ 59
|
||||||
|
lo_open @ 60
|
||||||
|
lo_close @ 61
|
||||||
|
lo_read @ 62
|
||||||
|
lo_write @ 63
|
||||||
|
lo_lseek @ 64
|
||||||
|
lo_creat @ 65
|
||||||
|
lo_tell @ 66
|
||||||
|
lo_unlink @ 67
|
||||||
|
lo_import @ 68
|
||||||
|
lo_export @ 69
|
||||||
|
|
35
src/interfaces/libpq/win32.h
Normal file
35
src/interfaces/libpq/win32.h
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
#include <winsock.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* strcasecmp() is not in Windows, stricmp is, though
|
||||||
|
*/
|
||||||
|
#define strcasecmp(a,b) stricmp(a,b)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define NO_UNISTD_H
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Some compat functions
|
||||||
|
*/
|
||||||
|
#define open(a,b,c) _open(a,b,c)
|
||||||
|
#define read(a,b,c) _read(a,b,c)
|
||||||
|
#define write(a,b,c) _write(a,b,c)
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* crypt not available (yet)
|
||||||
|
*/
|
||||||
|
#define crypt(a,b) a
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Parts of config.h that you get with autoconf on other systems
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Default port to connect to
|
||||||
|
*/
|
||||||
|
#define DEF_PGPORT "5432"
|
112
src/interfaces/libpq/win32.mak
Normal file
112
src/interfaces/libpq/win32.mak
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
# Makefile for Microsoft Visual C++ 5.0 (or compat)
|
||||||
|
|
||||||
|
# Will build a Win32 static library (non-debug) libpq.lib
|
||||||
|
# and a Win32 dynamic library (non-debug) libpq.dll with import library libpqdll.lib
|
||||||
|
|
||||||
|
|
||||||
|
!IF "$(OS)" == "Windows_NT"
|
||||||
|
NULL=
|
||||||
|
!ELSE
|
||||||
|
NULL=nul
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
|
CPP=cl.exe
|
||||||
|
|
||||||
|
OUTDIR=.\Release
|
||||||
|
INTDIR=.\Release
|
||||||
|
# Begin Custom Macros
|
||||||
|
OutDir=.\Release
|
||||||
|
# End Custom Macros
|
||||||
|
|
||||||
|
ALL : "$(OUTDIR)\libpq.lib" "$(OUTDIR)\libpq.dll"
|
||||||
|
|
||||||
|
CLEAN :
|
||||||
|
-@erase "$(INTDIR)\dllist.obj"
|
||||||
|
-@erase "$(INTDIR)\fe-auth.obj"
|
||||||
|
-@erase "$(INTDIR)\fe-connect.obj"
|
||||||
|
-@erase "$(INTDIR)\fe-exec.obj"
|
||||||
|
-@erase "$(INTDIR)\fe-lobj.obj"
|
||||||
|
-@erase "$(INTDIR)\fe-misc.obj"
|
||||||
|
-@erase "$(INTDIR)\fe-print.obj"
|
||||||
|
-@erase "$(OUTDIR)\libpqdll.obj"
|
||||||
|
-@erase "$(INTDIR)\vc50.idb"
|
||||||
|
-@erase "$(OUTDIR)\libpq.lib"
|
||||||
|
-@erase "$(OUTDIR)\libpq.dll"
|
||||||
|
|
||||||
|
"$(OUTDIR)" :
|
||||||
|
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||||
|
|
||||||
|
CPP_PROJ=/nologo /ML /W3 /GX /O2 /I "..\..\include" /D "NDEBUG" /D\
|
||||||
|
"WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\libpq.pch" /YX\
|
||||||
|
/Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
|
||||||
|
CPP_OBJS=.\Release/
|
||||||
|
CPP_SBRS=.
|
||||||
|
|
||||||
|
LIB32=link.exe -lib
|
||||||
|
LIB32_FLAGS=/nologo /out:"$(OUTDIR)\libpq.lib"
|
||||||
|
LIB32_OBJS= \
|
||||||
|
"$(INTDIR)\dllist.obj" \
|
||||||
|
"$(INTDIR)\fe-auth.obj" \
|
||||||
|
"$(INTDIR)\fe-connect.obj" \
|
||||||
|
"$(INTDIR)\fe-exec.obj" \
|
||||||
|
"$(INTDIR)\fe-lobj.obj" \
|
||||||
|
"$(INTDIR)\fe-misc.obj" \
|
||||||
|
"$(INTDIR)\fe-print.obj"
|
||||||
|
|
||||||
|
LINK32=link.exe
|
||||||
|
LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
|
||||||
|
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib wsock32.lib\
|
||||||
|
odbccp32.lib /nologo /subsystem:windows /dll /incremental:no\
|
||||||
|
/pdb:"$(OUTDIR)\libpqdll.pdb" /machine:I386 /out:"$(OUTDIR)\libpq.dll"\
|
||||||
|
/implib:"$(OUTDIR)\libpqdll.lib" /def:libpqdll.def
|
||||||
|
LINK32_OBJS= \
|
||||||
|
"$(INTDIR)\libpqdll.obj" \
|
||||||
|
"$(OUTDIR)\libpq.lib"
|
||||||
|
|
||||||
|
|
||||||
|
"$(OUTDIR)\libpq.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS)
|
||||||
|
$(LIB32) @<<
|
||||||
|
$(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS)
|
||||||
|
<<
|
||||||
|
|
||||||
|
"$(OUTDIR)\libpq.dll" : "$(OUTDIR)" "$(OUTDIR)\libpqdll.obj" "$(INTDIR)\libpqdll.obj"
|
||||||
|
$(LINK32) @<<
|
||||||
|
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||||
|
<<
|
||||||
|
|
||||||
|
|
||||||
|
"$(OUTDIR)\dllist.obj" : ..\..\backend\lib\dllist.c
|
||||||
|
$(CPP) @<<
|
||||||
|
$(CPP_PROJ) ..\..\backend\lib\dllist.c
|
||||||
|
<<
|
||||||
|
|
||||||
|
|
||||||
|
.c{$(CPP_OBJS)}.obj::
|
||||||
|
$(CPP) @<<
|
||||||
|
$(CPP_PROJ) $<
|
||||||
|
<<
|
||||||
|
|
||||||
|
.cpp{$(CPP_OBJS)}.obj::
|
||||||
|
$(CPP) @<<
|
||||||
|
$(CPP_PROJ) $<
|
||||||
|
<<
|
||||||
|
|
||||||
|
.cxx{$(CPP_OBJS)}.obj::
|
||||||
|
$(CPP) @<<
|
||||||
|
$(CPP_PROJ) $<
|
||||||
|
<<
|
||||||
|
|
||||||
|
.c{$(CPP_SBRS)}.sbr::
|
||||||
|
$(CPP) @<<
|
||||||
|
$(CPP_PROJ) $<
|
||||||
|
<<
|
||||||
|
|
||||||
|
.cpp{$(CPP_SBRS)}.sbr::
|
||||||
|
$(CPP) @<<
|
||||||
|
$(CPP_PROJ) $<
|
||||||
|
<<
|
||||||
|
|
||||||
|
.cxx{$(CPP_SBRS)}.sbr::
|
||||||
|
$(CPP) @<<
|
||||||
|
$(CPP_PROJ) $<
|
||||||
|
<<
|
17
src/win32.mak
Normal file
17
src/win32.mak
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
# Makefile for Microsoft Visual C++ 5.0 (or compat)
|
||||||
|
|
||||||
|
# Top-file makefile for Win32 parts of postgresql.
|
||||||
|
|
||||||
|
# Note that most parts are not ported to Win32!
|
||||||
|
|
||||||
|
!IF "$(OS)" == "Windows_NT"
|
||||||
|
NULL=
|
||||||
|
!ELSE
|
||||||
|
NULL=nul
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
|
ALL:
|
||||||
|
cd interfaces\libpq
|
||||||
|
nmake /f win32.mak
|
||||||
|
cd ..\..
|
||||||
|
echo All Win32 parts have been built!
|
Loading…
x
Reference in New Issue
Block a user