Received: from moutvdom00.kundenserver.de (moutvdom00.kundenserver.de [195.20.224.149]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f61Fjia19484 for ; Sun, 1 Jul 2001 11:45:44 -0400 (EDT) (envelope-from chris@chrullrich.de) Received: from [195.20.224.219] (helo=mrvdom03.kundenserver.de) by moutvdom00.kundenserver.de with esmtp (Exim 2.12 #2) id 15GjPn-00057j-00 for pgsql-interfaces@postgresql.org; Sun, 1 Jul 2001 17:45:39 +0200 Received: from pd95850cf.dip.t-dialin.net ([217.88.80.207] helo=ser1.chrullrich.de) by mrvdom03.kundenserver.de with esmtp (Exim 2.12 #2) id 15GjOq-0005Nm-00 for pgsql-interfaces@postgresql.org; Sun, 1 Jul 2001 17:44:41 +0200 Received: from christian.chrullrich.de (christian.chrullrich.de [192.168.0.2]) by ser1.chrullrich.de (Postfix) with ESMTP id D07D3135 for ; Sun, 1 Jul 2001 17:44:34 +0200 (CEST) Received: by christian.chrullrich.de (Postfix on SuSE Linux 7.2 (i386), from userid 1000) id BC331D80; Sun, 1 Jul 2001 17:45:49 +0200 (CEST) Date: Sun, 1 Jul 2001 17:45:49 +0200 From: Christian Ullrich To: pgsql-interfaces@postgresql.org Subject: Re: libpq++ on Windows Message-ID: <20010701174549.A976@christian.chrullrich.de> Mail-Followup-To: pgsql-interfaces@postgresql.org References: <20010630193730.A17961@christian.chrullrich.de> <20010701094846.B28577@christian.chrullrich.de> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="EuxKj2iCbKjpUGkD" Content-Disposition: inline Content-Transfer-Encoding: 8bit User-Agent: Mutt/1.3.16i In-Reply-To: <20010701094846.B28577@christian.chrullrich.de>; from chris@chrullrich.de on Sun, Jul 01, 2001 at 09:48:46AM +0200 X-Current-Uptime: 0 d, 00:05:22 h X-Archive-Number: 200107/2 X-Sequence-Number: 1755 --EuxKj2iCbKjpUGkD Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit * Christian Ullrich wrote on Sunday, 2001-07-01: > I will look into it. It should be enough to get it to work via the > GUI and export a Makefile (I wonder how they dare to call these Well, I found it was easier to adapt the win32.mak for libpq. So here is the patch. Notes: - The additions to config.h.in and config.h.win32 are not very elegant, especially config.h.in. But I need to export the classes, and that's the only way to go. - The static library doesn't work. It asserts while connecting. I've tried to find the bug, but failed miserably. WSAStartup() returned success, so that shouldn't be the reason. - The filenames are constructed like libpq's: - libpq++.dll: The working DLL. - libpq++.lib. The broken static library. - libpq++dll.lib: The DLL's import library. Goodbye. -- Christian Ullrich Registrierter Linux-User #125183 "Sie können nach R'ed'mond fliegen -- aber Sie werden sterben" --EuxKj2iCbKjpUGkD Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: attachment; filename="libpq++.diff" Content-Transfer-Encoding: 8bit diff -urN postgresql-7.1.2.orig/src/include/config.h.in postgresql-7.1.2/src/include/config.h.in --- postgresql-7.1.2.orig/src/include/config.h.in Sat Apr 14 22:55:02 2001 +++ postgresql-7.1.2/src/include/config.h.in Sun Jul 1 15:21:26 2001 @@ -675,6 +675,13 @@ #include "os.h" +/* + * The libpq++ headers need this for Win32 native DLL build with MSVC. + * Win32/Cygwin and Unix builds don't. + */ + +#define DLLAPI + /* * The following is used as the arg list for signal handlers. Any ports * that take something other than an int argument should override this in diff -urN postgresql-7.1.2.orig/src/include/config.h.win32 postgresql-7.1.2/src/include/config.h.win32 --- postgresql-7.1.2.orig/src/include/config.h.win32 Fri May 11 01:34:42 2001 +++ postgresql-7.1.2/src/include/config.h.win32 Sun Jul 1 15:21:26 2001 @@ -20,3 +20,13 @@ #define HAVE_ATEXIT #define HAVE_MEMMOVE + +#define HAVE_CXX_STRING_HEADER +#define HAVE_NAMESPACE_STD + +/* This is as good a place as any */ +#ifdef _DLL +#define DLLAPI __declspec(dllexport) +#else +#define DLLAPI __declspec(dllimport) +#endif /* _DLL */ diff -urN postgresql-7.1.2.orig/src/interfaces/libpq++/libpq++dll.rc postgresql-7.1.2/src/interfaces/libpq++/libpq++dll.rc --- postgresql-7.1.2.orig/src/interfaces/libpq++/libpq++dll.rc Thu Jan 1 00:00:00 1970 +++ postgresql-7.1.2/src/interfaces/libpq++/libpq++dll.rc Sun Jul 1 15:21:26 2001 @@ -0,0 +1,34 @@ +#include + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 7,1,2,0 + PRODUCTVERSION 7,1,2,0 + FILEFLAGSMASK 0x3fL + FILEFLAGS 0x0L + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", " \0" + VALUE "FileDescription", "PostgreSQL C++ Access Library\0" + VALUE "FileVersion", "7, 1, 2, 0\0" + VALUE "InternalName", "libpq++\0" + VALUE "LegalCopyright", "Copyright © 2000\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "libpq++.dll\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "PostgreSQL\0" + VALUE "ProductVersion", "7, 1, 2, 0\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END diff -urN postgresql-7.1.2.orig/src/interfaces/libpq++/pgconnection.h postgresql-7.1.2/src/interfaces/libpq++/pgconnection.h --- postgresql-7.1.2.orig/src/interfaces/libpq++/pgconnection.h Sat Feb 10 02:31:30 2001 +++ postgresql-7.1.2/src/interfaces/libpq++/pgconnection.h Sun Jul 1 15:21:26 2001 @@ -55,7 +55,7 @@ // This class contains all the information about the connection // to the backend process. All the database classes should be // derived from this class to obtain the connection interface. -class PgConnection { +class DLLAPI PgConnection { protected: PGconn* pgConn; // Connection Structure PGresult* pgResult; // Current Query Result diff -urN postgresql-7.1.2.orig/src/interfaces/libpq++/pgcursordb.h postgresql-7.1.2/src/interfaces/libpq++/pgcursordb.h --- postgresql-7.1.2.orig/src/interfaces/libpq++/pgcursordb.h Wed Jan 24 19:43:32 2001 +++ postgresql-7.1.2/src/interfaces/libpq++/pgcursordb.h Sun Jul 1 15:21:26 2001 @@ -36,7 +36,7 @@ // manipulates data through it. The interface will introduce some // ease of use through the methods that will allow cursor specific // operations, like fetch, forward, etc. -class PgCursor : public PgTransaction { +class DLLAPI PgCursor : public PgTransaction { public: PgCursor(const char* conninfo, const char* cursor); // use reasonable & environment defaults // connect to the database with given environment and database name diff -urN postgresql-7.1.2.orig/src/interfaces/libpq++/pgdatabase.h postgresql-7.1.2/src/interfaces/libpq++/pgdatabase.h --- postgresql-7.1.2.orig/src/interfaces/libpq++/pgdatabase.h Wed Jan 24 19:43:32 2001 +++ postgresql-7.1.2/src/interfaces/libpq++/pgdatabase.h Sun Jul 1 15:21:26 2001 @@ -34,7 +34,7 @@ // This is the basic database access class. Its interface should // be used only after a query has been sent to the backend and // results are being received. -class PgDatabase : public PgConnection { +class DLLAPI PgDatabase : public PgConnection { public: // connect to the database with conninfo PgDatabase(const char* conninfo) : PgConnection(conninfo) {} diff -urN postgresql-7.1.2.orig/src/interfaces/libpq++/pglobject.h postgresql-7.1.2/src/interfaces/libpq++/pglobject.h --- postgresql-7.1.2.orig/src/interfaces/libpq++/pglobject.h Wed Jan 24 19:43:32 2001 +++ postgresql-7.1.2/src/interfaces/libpq++/pglobject.h Sun Jul 1 15:21:26 2001 @@ -29,7 +29,7 @@ // PgLargeObject - a class for accessing Large Object in a database // // **************************************************************** -class PgLargeObject : public PgConnection { +class DLLAPI PgLargeObject : public PgConnection { private: int pgFd; Oid pgObject; diff -urN postgresql-7.1.2.orig/src/interfaces/libpq++/pgtransdb.h postgresql-7.1.2/src/interfaces/libpq++/pgtransdb.h --- postgresql-7.1.2.orig/src/interfaces/libpq++/pgtransdb.h Wed Jan 24 19:43:32 2001 +++ postgresql-7.1.2/src/interfaces/libpq++/pgtransdb.h Sun Jul 1 15:21:26 2001 @@ -34,7 +34,7 @@ // This is the database access class that keeps an open // transaction block during its lifetime. The block is ENDed when // the object is destroyed. -class PgTransaction : public PgDatabase { +class DLLAPI PgTransaction : public PgDatabase { public: PgTransaction(const char* conninfo); // use reasonable & environment defaults // connect to the database with given environment and database name diff -urN postgresql-7.1.2.orig/src/interfaces/libpq++/win32.mak postgresql-7.1.2/src/interfaces/libpq++/win32.mak --- postgresql-7.1.2.orig/src/interfaces/libpq++/win32.mak Thu Jan 1 00:00:00 1970 +++ postgresql-7.1.2/src/interfaces/libpq++/win32.mak Sun Jul 1 15:21:26 2001 @@ -0,0 +1,126 @@ +# Makefile for Microsoft Visual C++ 6.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 libpq++dll.lib + + +!IF "$(OS)" == "Windows_NT" +NULL= +!ELSE +NULL=nul +!ENDIF + +.SUFFIXES : .cc + +CPP=cl.exe +RSC=rc.exe + +OUTDIR=.\Release +INTDIR=.\Release +# Begin Custom Macros +OutDir=.\Release +# End Custom Macros + +ALL : "$(OUTDIR)\libpq++.dll" "$(OUTDIR)\libpq++.lib" + +CLEAN : + -@erase "$(INTDIR)\pgconnection.obj" + -@erase "$(INTDIR)\pgcursordb.obj" + -@erase "$(INTDIR)\pgdatabase.obj" + -@erase "$(INTDIR)\pglobject.obj" + -@erase "$(INTDIR)\pgtransdb.obj" + -@erase "$(OUTDIR)\libpq++.lib" + -@erase "$(OUTDIR)\libpq++.dll" + -@erase "$(OUTDIR)\libpq++dll.exp" + -@erase "$(OUTDIR)\libpq++dll.lib" + -@erase "$(OUTDIR)\libpq++dll.res" + -@erase "*.pch" + -@erase "$(OUTDIR)\libpq++.pch" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +CPP_PROJ=/nologo /TP /MD /W3 /GX /O2 /I "..\..\include" /I "..\libpq" /D "NDEBUG" /D\ + "WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\libpq++.pch" /YX\ + /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c /D "HAVE_VSNPRINTF" /D "HAVE_STRDUP" + +CPP_OBJS=.\Release/ +CPP_SBRS=. + +LIB32=link.exe -lib +LIB32_FLAGS=/nologo /out:"$(OUTDIR)\libpq++.lib" +LIB32_OBJS= \ + "$(OUTDIR)\pgconnection.obj" \ + "$(OUTDIR)\pgcursordb.obj" \ + "$(OUTDIR)\pgdatabase.obj" \ + "$(OUTDIR)\pglobject.obj" \ + "$(OUTDIR)\pgtransdb.obj" + +RSC_PROJ=/l 0x409 /fo"$(INTDIR)\libpq++dll.res" + +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 libpq.lib msvcrt.lib /nologo /subsystem:windows /dll /incremental:no\ + /pdb:"$(OUTDIR)\libpq++.pdb" /machine:I386 /out:"$(OUTDIR)\libpq++.dll"\ + /implib:"$(OUTDIR)\libpq++dll.lib" /libpath:"..\libpq\release" +LINK32_OBJS= \ + "$(OUTDIR)\pgconnection.obj" \ + "$(OUTDIR)\pgcursordb.obj" \ + "$(OUTDIR)\pgdatabase.obj" \ + "$(OUTDIR)\pglobject.obj" \ + "$(OUTDIR)\pgtransdb.obj" \ + "$(OUTDIR)\libpq++dll.res" + +"$(INTDIR)\libpq++dll.res" : "$(INTDIR)" libpq++dll.rc + $(RSC) $(RSC_PROJ) libpq++dll.rc + +"$(OUTDIR)\libpq++.lib" : "$(OUTDIR)" $(LIB32_OBJS) + $(LIB32) @<< + $(LIB32_FLAGS) $(LIB32_OBJS) +<< + +"$(OUTDIR)\libpq++.dll" : "$(OUTDIR)" $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +.c{$(CPP_OBJS)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(CPP_OBJS)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cc{$(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) $< +<< + +.cc{$(CPP_SBRS)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(CPP_SBRS)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< diff -urN postgresql-7.1.2.orig/src/win32.mak postgresql-7.1.2/src/win32.mak --- postgresql-7.1.2.orig/src/win32.mak Tue Jan 18 19:05:29 2000 +++ postgresql-7.1.2/src/win32.mak Sun Jul 1 15:22:15 2001 @@ -19,6 +19,8 @@ if not exist config.h copy config.h.win32 config.h cd .. cd interfaces\libpq + nmake /f win32.mak $(MAKEMACRO) + cd ..\libpq++ nmake /f win32.mak $(MAKEMACRO) cd ..\..\bin\psql nmake /f win32.mak $(MAKEMACRO) --EuxKj2iCbKjpUGkD--