pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Heikki Linnakangas <hlinnakangas@vmware.com>
To: Inoue, Hiroshi <inoue@tpf.co.jp>
To: pgsql-odbc@postgresql.org <pgsql-odbc@postgresql.org>
Subject: Re: Why separate pgenlist DLL?
Date: Sat, 21 Jun 2014 14:46:08 +0300
Message-ID: <53A57080.1070501@vmware.com> (raw)
In-Reply-To: <53A0054A.5050508@tpf.co.jp>
References: <539F2D15.9020604@vmware.com>
	<53A0054A.5050508@tpf.co.jp>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-odbc>

On 06/17/2014 12:07 PM, Inoue, Hiroshi wrote:
> (2014/06/17 2:44), Heikki Linnakangas wrote:
>> Hi,
>>
>> On Windows, when the driver is built with MSDTC support, we build some
>> of the MSDTC functions in separate DLLs: pgenlist.dll and pgxalib.dll.
>> Why do we do that? Why not just link everything in the main DLL?
>
> pgxalib.dll should be a separate DLL because it is essentially irrevant
>    to the drivers. It is called from MSDTC process when resolutions of
> in-doubt transactions are needed. As Craig Ringer reported, the 64bit
> pgxalib.dll is used on 64bit OS even when transactions are PREPAREd
> via 32bit ODBC applications. Though pgxalib.dll calls ODBC APIs
> currently, it's not calling driver's APIs directly and can call e.g.
> libpq APIs instead.

Oh, I see.

> As for pgenlist(a).dll, though I've never thought to unify it with
> main DLL, there may be a room for discussion.
>
> There were some reasons.
> 1. Basically for Windows only.
> 2. Many users don't use this functionality at all.
> 3. COM-style C++ programming and most part of the code is handling
>      asynchronous requests for COM-like objects out of ODBC APIs.
>
> I have been much more nervous in programming pgenlist than psqlodbc
> and have felt isolating the code is preferable.

Yeah, it makes sense to keep some distance. I think it would be OK to 
merge it into the main DLL though. It would allow us to remove a fair 
amount of glue code, and would simplify the build process. I propose the 
attached to do that (against my winbuild branch in github, which 
contains the MSBuild infrastructure changes)

- Heikki

-- 
Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc

Attachments:

0001-Link-msdtc_enlist.cpp-into-the-main-DLL.patch (text/x-diff, 23.7K) download From 03c1aef5e2d084e1638241cdcec4e68ed839da49 Mon Sep 17 00:00:00 2001 From: Heikki Linnakangas <heikki.linnakangas@iki.fi> Date: Thu, 19 Jun 2014 16:57:52 +0300 Subject: [PATCH] Link msdtc_enlist.cpp into the main DLL diff --git a/connection.c b/connection.c index 04887b7..b452afa 100644 --- a/connection.c +++ b/connection.c @@ -48,6 +48,7 @@ #include "qresult.h" #include "lobj.h" #include "dlg_specific.h" +#include "pgenlist.h" #include "loadlib.h" #include "multibyte.h" @@ -555,7 +556,7 @@ CC_examine_global_transaction(ConnectionClass *self) if (!self) return; #ifdef _HANDLE_ENLIST_IN_DTC_ if (CC_is_in_global_trans(self)) - CALL_IsolateDtcConn(self, TRUE); + IsolateDtcConn(self, TRUE); #endif /* _HANDLE_ENLIST_IN_DTC_ */ } @@ -4337,16 +4338,15 @@ const char *CurrCatString(const ConnectionClass *conn) #ifdef _HANDLE_ENLIST_IN_DTC_ /* - * Export the following functions so that the pgenlist dll + * Export the following functions so that the msdtc_pgenlist.cpp * can handle ConnectionClass objects as opaque ones. */ -#define _PGDTC_FUNCS_IMPLEMENT_ #include "connexp.h" #define SYNC_AUTOCOMMIT(conn) (SQL_AUTOCOMMIT_OFF != conn->connInfo.autocommit_public ? (conn->transact_status |= CONN_IN_AUTOCOMMIT) : (conn->transact_status &= ~CONN_IN_AUTOCOMMIT)) -DLL_DECLARE void PgDtc_create_connect_string(void *self, char *connstr, int strsize) +void PgDtc_create_connect_string(void *self, char *connstr, int strsize) { ConnectionClass *conn = (ConnectionClass *) self; @@ -4355,7 +4355,7 @@ DLL_DECLARE void PgDtc_create_connect_string(void *self, char *connstr, int strs ci->drivername, ci->server, ci->port, ci->database, ci->username, SAFE_NAME(ci->password), ci->sslmode); } -DLL_DECLARE void PgDtc_set_async(void *self, void *async) +void PgDtc_set_async(void *self, void *async) { ConnectionClass *conn = (ConnectionClass *) self; @@ -4369,14 +4369,14 @@ DLL_DECLARE void PgDtc_set_async(void *self, void *async) CONNLOCK_RELEASE(conn); } -DLL_DECLARE void *PgDtc_get_async(void *self) +void *PgDtc_get_async(void *self) { ConnectionClass *conn = (ConnectionClass *) self; return conn->asdum; } -DLL_DECLARE void PgDtc_set_property(void *self, int property, void *value) +void PgDtc_set_property(void *self, int property, void *value) { ConnectionClass *conn = (ConnectionClass *) self; @@ -4405,14 +4405,14 @@ DLL_DECLARE void PgDtc_set_property(void *self, int property, void *value) CONNLOCK_RELEASE(conn); } -DLL_DECLARE void PgDtc_set_error(void *self, const char *message, const char *func) +void PgDtc_set_error(void *self, const char *message, const char *func) { ConnectionClass *conn = (ConnectionClass *) self; CC_set_error(conn, CONN_UNSUPPORTED_OPTION, message, func); } -DLL_DECLARE int PgDtc_get_property(void *self, int property) +int PgDtc_get_property(void *self, int property) { ConnectionClass *conn = (ConnectionClass *) self; int ret; @@ -4446,7 +4446,7 @@ DLL_DECLARE int PgDtc_get_property(void *self, int property) return ret; } -DLL_DECLARE BOOL PgDtc_connect(void *self) +BOOL PgDtc_connect(void *self) { CSTR func = "PgDtc_connect"; ConnectionClass *conn = (ConnectionClass *) self; @@ -4462,14 +4462,14 @@ DLL_DECLARE BOOL PgDtc_connect(void *self) return TRUE; } -DLL_DECLARE void PgDtc_free_connect(void *self) +void PgDtc_free_connect(void *self) { ConnectionClass *conn = (ConnectionClass *) self; PGAPI_FreeConnect(conn); } -DLL_DECLARE BOOL PgDtc_one_phase_operation(void *self, int operation) +BOOL PgDtc_one_phase_operation(void *self, int operation) { ConnectionClass *conn = (ConnectionClass *) self; BOOL ret, is_in_progress = CC_is_dtc_executing(conn); @@ -4492,7 +4492,7 @@ DLL_DECLARE BOOL PgDtc_one_phase_operation(void *self, int operation) return ret; } -DLL_DECLARE BOOL +BOOL PgDtc_two_phase_operation(void *self, int operation, const char *gxid) { ConnectionClass *conn = (ConnectionClass *) self; @@ -4520,7 +4520,7 @@ PgDtc_two_phase_operation(void *self, int operation, const char *gxid) return ret; } -DLL_DECLARE BOOL +BOOL PgDtc_lock_cntrl(void *self, BOOL acquire, BOOL bTrial) { ConnectionClass *conn = (ConnectionClass *) self; @@ -4551,7 +4551,7 @@ CC_Copy(const ConnectionClass *conn) } #define CLEANUP_CONN_BEFORE_ISOLATION -DLL_DECLARE void * +void * PgDtc_isolate(void *self, DWORD option) { BOOL disposingConn = (0 != (disposingConnection & option)); diff --git a/connection.h b/connection.h index e92ff61..34008c2 100644 --- a/connection.h +++ b/connection.h @@ -155,10 +155,10 @@ do { \ #define DELETE_CONN_CS(x) DeleteCriticalSection(&((x)->cs)) #define DELETE_CONNLOCK(x) DeleteCriticalSection(&((x)->slock)) #elif defined(POSIX_THREADMUTEX_SUPPORT) -#define INIT_CONN_CS(x) pthread_mutex_init(&((x)->cs), getMutexAttr()) -#define INIT_CONNLOCK(x) pthread_mutex_init(&((x)->slock), getMutexAttr()) -#define ENTER_CONN_CS(x) pthread_mutex_lock(&((x)->cs)) -#define CONNLOCK_ACQUIRE(x) pthread_mutex_lock(&((x)->slock)) +#define INIT_CONN_CS(x) if (pthread_mutex_init(&((x)->cs), getMutexAttr()) != 0) perror("INIT_CONN_CS failed") +#define INIT_CONNLOCK(x) if (pthread_mutex_init(&((x)->slock), getMutexAttr()) != 0) perror("INIT_CONNLOCK failed") +#define ENTER_CONN_CS(x) if (pthread_mutex_lock(&((x)->cs)) != 0) perror("ENTER_CONN_CS failed") +#define CONNLOCK_ACQUIRE(x) if (pthread_mutex_lock(&((x)->slock)) != 0) perror("CONNLOCK_ACQUIRE failed") #define TRY_ENTER_CONN_CS(x) (0 == pthread_mutex_trylock(&((x)->cs))) #define ENTER_INNER_CONN_CS(x, entered) \ do { \ @@ -168,8 +168,10 @@ do { \ entered++; \ } \ } while (0) -#define LEAVE_CONN_CS(x) pthread_mutex_unlock(&((x)->cs)) -#define CONNLOCK_RELEASE(x) pthread_mutex_unlock(&((x)->slock)) +#define STRINGIZE_DETAIL(x) #x +#define STRINGIZE(x) STRINGIZE_DETAIL(x) +#define LEAVE_CONN_CS(x) if (pthread_mutex_unlock(&((x)->cs)) != 0) perror("LEAVE_CONN_CS failed (" __FILE__ ", line " STRINGIZE(__LINE__) ")") +#define CONNLOCK_RELEASE(x) if (pthread_mutex_unlock(&((x)->slock)) != 0) perror("CONNLOCK_RELEASE failed") #define DELETE_CONN_CS(x) pthread_mutex_destroy(&((x)->cs)) #define DELETE_CONNLOCK(x) pthread_mutex_destroy(&((x)->slock)) #else diff --git a/connexp.h b/connexp.h index e71776b..c128308 100644 --- a/connexp.h +++ b/connexp.h @@ -9,22 +9,6 @@ #ifndef __CONNEXPORT_H__ #define __CONNEXPORT_H__ -/* - * The psqlodbc dll exports functions below used in the pgenlist dll. - * - */ - -#undef DLL_DECLARE -#ifdef _PGDTC_FUNCS_IMPLEMENT_ -#define DLL_DECLARE _declspec(dllexport) -#else -#ifdef _PGDTC_FUNCS_IMPORT_ -#define DLL_DECLARE _declspec(dllimport) -#else -#define DLL_DECLARE -#endif /* _PGDTC_FUNC_IMPORT_ */ -#endif /* _PGDTC_FUNCS_IMPLEMENT_ */ - #ifdef __cplusplus extern "C" { #endif @@ -61,18 +45,18 @@ enum { ,ROLLBACK_PREPARED }; -DLL_DECLARE void PgDtc_create_connect_string(void *self, char *connstr, int strsize); -DLL_DECLARE void PgDtc_set_async(void *self, void *async); -DLL_DECLARE void *PgDtc_get_async(void *self); -DLL_DECLARE void PgDtc_set_property(void *self, int property, void *value); -DLL_DECLARE void PgDtc_set_error(void *self, const char *message, const char *func); -DLL_DECLARE int PgDtc_get_property(void *self, int property); -DLL_DECLARE BOOL PgDtc_connect(void *self); -DLL_DECLARE void PgDtc_free_connect(void *self); -DLL_DECLARE BOOL PgDtc_one_phase_operation(void *self, int operation); -DLL_DECLARE BOOL PgDtc_two_phase_operation(void *self, int operation, const char *gxid); -DLL_DECLARE BOOL PgDtc_lock_cntrl(void *self, BOOL acquire, BOOL bTrial); -DLL_DECLARE void *PgDtc_isolate(void *self, DWORD option); +extern void PgDtc_create_connect_string(void *self, char *connstr, int strsize); +extern void PgDtc_set_async(void *self, void *async); +extern void *PgDtc_get_async(void *self); +extern void PgDtc_set_property(void *self, int property, void *value); +extern void PgDtc_set_error(void *self, const char *message, const char *func); +extern int PgDtc_get_property(void *self, int property); +extern BOOL PgDtc_connect(void *self); +extern void PgDtc_free_connect(void *self); +extern BOOL PgDtc_one_phase_operation(void *self, int operation); +extern BOOL PgDtc_two_phase_operation(void *self, int operation, const char *gxid); +extern BOOL PgDtc_lock_cntrl(void *self, BOOL acquire, BOOL bTrial); +extern void *PgDtc_isolate(void *self, DWORD option); #ifdef __cplusplus } diff --git a/installer/psqlodbcm_cpu.wxs b/installer/psqlodbcm_cpu.wxs index d546da8..9b5614c 100644 --- a/installer/psqlodbcm_cpu.wxs +++ b/installer/psqlodbcm_cpu.wxs @@ -60,8 +60,6 @@ <File Id="psqlodbc30a.dll" Name="psqlodbc30a.dll" Source="../$(var.ANSIFOLDER)/psqlodbc30a.dll" /> <File Id="psqlodbc35w.dll" Name="psqlodbc35w.dll" Source="../$(var.UNICODEFOLDER)/psqlodbc35w.dll" /> <File Id="pgxalib.dll" Name="pgxalib.dll" Source="../$(var.UNICODEFOLDER)/pgxalib.dll" /> - <File Id="pgenlist.dll" Name="pgenlist.dll" Source="../$(var.UNICODEFOLDER)/pgenlist.dll" /> - <File Id="pgenlista.dll" Name="pgenlista.dll" Source="../$(var.ANSIFOLDER)/pgenlista.dll" /> <?if "$(var.LIBPQBINDIR)" != "" ?> <File Id="libpq.dll" Name="libpq.dll" Source="$(var.LIBPQBINDIR)\libpq.dll" KeyPath="yes" /> diff --git a/loadlib.c b/loadlib.c index 29f417b..7d3e715 100644 --- a/loadlib.c +++ b/loadlib.c @@ -22,7 +22,6 @@ #endif /* RESET_CRYPTO_CALLBACKS */ #include <libpq-fe.h> #endif /* USE_LIBPQ */ -#include "pgenlist.h" #ifdef WIN32 #ifdef _MSC_VER @@ -34,13 +33,6 @@ #pragma comment(lib, "libeay32") #endif /* RESET_CRYPTO_CALLBACKS */ #endif /* USE_LIBPQ */ -#ifdef _HANDLE_ENLIST_IN_DTC_ -#ifdef UNICODE_SUPPORT -#pragma comment(lib, "pgenlist") -#else -#pragma comment(lib, "pgenlista") -#endif /* UNICODE_SUPPORT */ -#endif /* _HANDLE_ENLIST_IN_DTC_ */ // The followings works under VC++6.0 but doesn't work under VC++7.0. // Please add the equivalent linker options using command line etc. #if (_MSC_VER == 1200) && defined(DYNAMIC_LOAD) // VC6.0 @@ -51,11 +43,6 @@ #pragma comment(linker, "/Delayload:libeay32.dll") #endif /* RESET_CRYPTO_CALLBACKS */ #endif /* USE_LIBPQ */ -#ifdef UNICODE_SUPPORT -#pragma comment(linker, "/Delayload:pgenlist.dll") -#else -#pragma comment(linker, "/Delayload:pgenlista.dll") -#endif /* UNICODE_SUPPORT */ #pragma comment(linker, "/Delay:UNLOAD") #endif /* _MSC_VER */ #endif /* _MSC_VER */ @@ -68,13 +55,6 @@ CSTR gssapidll = "GSSAPI64.dll"; #else CSTR gssapidll = "GSSAPI32.dll"; #endif /* _WIN64 */ -#ifdef UNICODE_SUPPORT -CSTR pgenlist = "pgenlist"; -CSTR pgenlistdll = "PGENLIST.dll"; -#else -CSTR pgenlist = "pgenlista"; -CSTR pgenlistdll = "PGENLISTA.dll"; -#endif /* UNICODE_SUPPORT */ #if defined(_MSC_VER) && (_MSC_VER >= 1200) #define _MSC_DELAY_LOAD_IMPORT #endif /* MSC_VER */ @@ -96,7 +76,7 @@ static int sslverify_available = -1; #if defined(_MSC_DELAY_LOAD_IMPORT) static BOOL loaded_libpq = FALSE, loaded_ssllib = FALSE; -static BOOL loaded_pgenlist = FALSE, loaded_gssapi = FALSE; +static BOOL loaded_gssapi = FALSE; /* * Load psqlodbc path based libpq dll. */ @@ -177,11 +157,6 @@ inolog("connect_withparam_available=%d\n", connect_withparam_available); } #endif /* USE_LIBPQ */ } - else if (_strnicmp(pdli->szDll, pgenlist, strlen(pgenlist)) == 0) - { - if (hmodule = MODULE_load_from_psqlodbc_path(pgenlist), NULL == hmodule) - hmodule = LoadLibrary(pgenlist); - } #ifdef USE_GSS else if (_strnicmp(pdli->szDll, gssapilib, strlen(gssapilib)) == 0) { @@ -255,11 +230,6 @@ void CleanupDelayLoadedDLLs(void) success = (*func)(SSL_DLL); mylog("ssldll unload success=%d\n", success); } - if (loaded_pgenlist) - { - success = (*func)(pgenlistdll); - mylog("%s unload success=%d\n", pgenlistdll, success); - } if (loaded_gssapi) { success = (*func)(gssapidll); @@ -443,53 +413,6 @@ BOOL connect_with_param_available(void) } #endif /* USE_LIBPQ */ -#ifdef _HANDLE_ENLIST_IN_DTC_ -RETCODE CALL_EnlistInDtc(ConnectionClass *conn, void *pTra, int method) -{ - RETCODE ret; - BOOL loaded = TRUE; - -#if defined(_MSC_DELAY_LOAD_IMPORT) - __try { -#if (_MSC_VER < 1300) - __pfnDliFailureHook = DliErrorHook; - __pfnDliNotifyHook = DliErrorHook; -#else - __pfnDliFailureHook2 = DliErrorHook; - __pfnDliNotifyHook2 = DliErrorHook; -#endif /* _MSC_VER */ - ret = EnlistInDtc(conn, pTra, method); - } - __except ((GetExceptionCode() & 0xffff) == ERROR_MOD_NOT_FOUND ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) { - loaded = FALSE; - } - if (loaded) - loaded_pgenlist = TRUE; -#if (_MSC_VER < 1300) - __pfnDliNotifyHook = NULL; -#else - __pfnDliNotifyHook2 = NULL; -#endif /* _MSC_VER */ -#else - ret = EnlistInDtc(conn, pTra, method); - loaded_pgenlist = TRUE; -#endif /* _MSC_DELAY_LOAD_IMPORT */ - return ret; -} -RETCODE CALL_DtcOnDisconnect(ConnectionClass *conn) -{ - if (loaded_pgenlist) - return DtcOnDisconnect(conn); - return FALSE; -} -RETCODE CALL_IsolateDtcConn(ConnectionClass *conn, BOOL continueConnection) -{ - if (loaded_pgenlist) - return IsolateDtcConn(conn, continueConnection); - return FALSE; -} -#endif /* _HANDLE_ENLIST_IN_DTC_ */ - #if defined(WIN_DYN_LOAD) BOOL SSLLIB_check(void) { diff --git a/loadlib.h b/loadlib.h index e144ac7..b214945 100644 --- a/loadlib.h +++ b/loadlib.h @@ -30,11 +30,6 @@ void *CALL_PQconnectdbParams(const char *opts[], const char *vals[], BOOL *); #endif /* USE_LIBPQ */ BOOL ssl_verify_available(void); BOOL connect_with_param_available(void); -#ifdef _HANDLE_ENLIST_IN_DTC_ -RETCODE CALL_EnlistInDtc(ConnectionClass *conn, void * pTra, int method); -RETCODE CALL_DtcOnDisconnect(ConnectionClass *); -RETCODE CALL_IsolateDtcConn(ConnectionClass *, BOOL); -#endif /* _HANDLE_ENLIST_IN_DTC_ */ /* void UnloadDelayLoadedDLLs(BOOL); */ void CleanupDelayLoadedDLLs(void); diff --git a/msdtc_enlist.cpp b/msdtc_enlist.cpp index ff40761..3c922ef 100755 --- a/msdtc_enlist.cpp +++ b/msdtc_enlist.cpp @@ -18,7 +18,6 @@ #include <oleTx2xa.h> #include <XOLEHLP.h> /*#include <Txdtc.h>*/ -#define _PGDTC_FUNCS_IMPORT_ #include "connexp.h" /*#define _SLEEP_FOR_TEST_*/ @@ -47,23 +46,6 @@ #define CSTR static const char * const #endif /* CSTR */ -EXTERN_C { -HINSTANCE s_hModule; /* Saved module handle. */ -} -/* This is where the Driver Manager attaches to this Driver */ -BOOL WINAPI -DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved) -{ - switch (ul_reason_for_call) - { - case DLL_PROCESS_ATTACH: - s_hModule = (HINSTANCE) hInst; /* Save for dialog boxes - */ - break; - } - return TRUE; -} - /* * A comment About locks used in this module * diff --git a/mylog.c b/mylog.c index 683d583..c0df032 100644 --- a/mylog.c +++ b/mylog.c @@ -220,7 +220,7 @@ logs_on_off(int cnopen, int mylog_onoff, int qlog_onoff) #endif /* LOGGING_PROCESS_TIME */ #ifdef MY_LOG static FILE *MLOGFP = NULL; -DLL_DECLARE void +void mylog(const char *fmt,...) { va_list args; @@ -277,7 +277,7 @@ mylog(const char *fmt,...) LEAVE_MYLOG_CS; GENERAL_ERRNO_SET(gerrno); } -DLL_DECLARE void +void forcelog(const char *fmt,...) { static BOOL force_on = TRUE; diff --git a/mylog.h b/mylog.h index 50f394c..62570cf 100644 --- a/mylog.h +++ b/mylog.h @@ -9,21 +9,6 @@ #ifndef __MYLOG_H__ #define __MYLOG_H__ -#undef DLL_DECLARE -#ifdef WIN32 -#ifdef _MYLOG_FUNCS_IMPLEMENT_ -#define DLL_DECLARE _declspec(dllexport) -#else -#ifdef _MYLOG_FUNCS_IMPORT_ -#define DLL_DECLARE _declspec(dllimport) -#else -#define DLL_DECLARE -#endif /* _MYLOG_FUNCS_IMPORT_ */ -#endif /* _MYLOG_FUNCS_IMPLEMENT_ */ -#else -#define DLL_DECLARE -#endif /* WIN32 */ - #include <stdio.h> #ifndef WIN32 #include <unistd.h> @@ -49,8 +34,8 @@ extern "C" { #define Q_LOG #ifdef MY_LOG -DLL_DECLARE void mylog(const char *fmt,...); -DLL_DECLARE void forcelog(const char *fmt,...); +extern void mylog(const char *fmt,...); +extern void forcelog(const char *fmt,...); #define inolog if (get_mylog() > 1) mylog /* for really temporary debug */ #else /* MY_LOG */ diff --git a/odbcapi.c b/odbcapi.c index b5b5aac..15e9215 100644 --- a/odbcapi.c +++ b/odbcapi.c @@ -311,7 +311,7 @@ SQLDisconnect(HDBC ConnectionHandle) mylog("[%s for %p]", func, ConnectionHandle); #ifdef _HANDLE_ENLIST_IN_DTC_ if (CC_is_in_global_trans(conn)) - CALL_DtcOnDisconnect(conn); + DtcOnDisconnect(conn); #endif /* _HANDLE_ENLIST_IN_DTC_ */ ENTER_CONN_CS(conn); CC_clear_error(conn); diff --git a/pgapi30.c b/pgapi30.c index a5bd4d2..2689614 100644 --- a/pgapi30.c +++ b/pgapi30.c @@ -27,7 +27,7 @@ #include "descriptor.h" #include "qresult.h" #include "pgapifunc.h" -#include "loadlib.h" +#include "pgenlist.h" /* SQLError -> SQLDiagRec */ @@ -1658,8 +1658,8 @@ PGAPI_SetConnectAttr(HDBC ConnectionHandle, * transaction. */ if (NULL != Value && CC_is_in_global_trans(conn)) - CALL_IsolateDtcConn(conn, TRUE); - return CALL_EnlistInDtc(conn, Value, conn->connInfo.xa_opt); + IsolateDtcConn(conn, TRUE); + return EnlistInDtc(conn, Value, conn->connInfo.xa_opt); } #endif /* _HANDLE_ENLIST_IN_DTC_ */ #endif /* WIN32 */ diff --git a/pgenlist.def b/pgenlist.def deleted file mode 100644 index 2d67170..0000000 --- a/pgenlist.def +++ /dev/null @@ -1,5 +0,0 @@ -LIBRARY pgenlist -EXPORTS -EnlistInDtc -DtcOnDisconnect -IsolateDtcConn diff --git a/pgenlista.def b/pgenlista.def deleted file mode 100644 index e0c8f7f..0000000 --- a/pgenlista.def +++ /dev/null @@ -1,5 +0,0 @@ -LIBRARY pgenlista -EXPORTS -EnlistInDtc -DtcOnDisconnect -IsolateDtcConn diff --git a/statement.c b/statement.c index a6229f6..e133db0 100644 --- a/statement.c +++ b/statement.c @@ -27,7 +27,7 @@ #include "qresult.h" #include "convert.h" #include "environ.h" -#include "loadlib.h" +#include "pgenlist.h" #include <stdio.h> #include <string.h> @@ -2494,7 +2494,7 @@ RequestStart(StatementClass *stmt, ConnectionClass *conn, const char *func) #ifdef _HANDLE_ENLIST_IN_DTC_ if (conn->asdum) - CALL_IsolateDtcConn(conn, TRUE); + IsolateDtcConn(conn, TRUE); #endif /* _HANDLE_ENLIST_IN_DTC_ */ if (SC_accessed_db(stmt)) return TRUE; diff --git a/winbuild.proj b/winbuild.proj index fe2a171..ecc7e3e 100755 --- a/winbuild.proj +++ b/winbuild.proj @@ -32,14 +32,7 @@ Targets: <!-- Build the driver DLLs, with current combination of ANSI/Unicode, 32-bit/64-bit and Debug/Release configuration. --> <Target Name="BuildDriver"> - <!-- pgenlist.dll and psqlodbc.dll both depend on each other, so - building one before the other will fail, in either order. - To work around that, first build just the import libraries. - --> - <MSBuild Projects="winbuild\psqlodbc.vcxproj;winbuild\pgenlist.vcxproj" - Targets="BuildImportLib" /> - - <MSBuild Projects="winbuild\psqlodbc.vcxproj;winbuild\pgenlist.vcxproj;winbuild\pgxalib.vcxproj" + <MSBuild Projects="winbuild\psqlodbc.vcxproj;winbuild\pgxalib.vcxproj" Targets="Build"/> </Target> diff --git a/winbuild/pgenlist.vcxproj b/winbuild/pgenlist.vcxproj deleted file mode 100755 index fb48216..0000000 --- a/winbuild/pgenlist.vcxproj +++ /dev/null @@ -1,68 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{DFD90C9A-E9BA-4CA3-812B-E820EE9A3F5B}</ProjectGuid> - <Keyword>Win32Proj</Keyword> - <RootNamespace>pgenlist</RootNamespace> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - - <Import Project="psqlodbc.common.props" /> - <Import Project="psqlodbc.Cpp.props" /> - - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - - <PropertyGroup> - <!-- Override IntDir, originally set in psqlodbc.Cpp.props --> - <IntDir>$(IntDir)\pgenlist\</IntDir> - </PropertyGroup> - - <PropertyGroup> - <!-- The Link step uses this to determine the name of the output DLL file --> - <TargetName>$(DTCDLL)</TargetName> - </PropertyGroup> - - <Target Name="BuildImportLib"> - <MakeDir Directories="$(OutDir)"/> - <Exec command='lib /def:$(srcPath)$(DTCDLL).def /machine:$(TARGET_CPU) /out:"$(OutDir)$(DTCDLL).lib"' /> - </Target> - - <ItemDefinitionGroup> - <Link> - <ModuleDefinitionFile>$(srcPath)$(DTCDLL).def</ModuleDefinitionFile> - - <DelayLoadDLLs>XOLEHLP.dll;%(DelayLoadDLLs)</DelayLoadDLLs> - <AdditionalDependencies>xolehlp.lib;$(MAINDLL).lib;%(AdditionalDependencies)</AdditionalDependencies> - <AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> - </Link> - </ItemDefinitionGroup> - - <ItemGroup> - <ClCompile Include="$(srcPath)msdtc_enlist.cpp" /> - <ClCompile Include="$(srcPath)xalibname.c" /> - </ItemGroup> - - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - -</Project> diff --git a/winbuild/psqlodbc.Cpp.props b/winbuild/psqlodbc.Cpp.props index 73f6fbb..0a314ba 100644 --- a/winbuild/psqlodbc.Cpp.props +++ b/winbuild/psqlodbc.Cpp.props @@ -68,12 +68,10 @@ Set properties common for all C/C++ projects. <PropertyGroup Condition="$(ANSI_VERSION)"> <MAINDLL>psqlodbc30a</MAINDLL> <MAINDEF>$(srcPath)psqlodbca.def</MAINDEF> - <DTCDLL>pgenlista</DTCDLL> </PropertyGroup> <PropertyGroup Condition="!$(ANSI_VERSION)"> <MAINDLL>psqlodbc35w</MAINDLL> <MAINDEF>$(srcPath)psqlodbc.def</MAINDEF> - <DTCDLL>pgenlist</DTCDLL> </PropertyGroup> <!-- MEMORY_DEBUG --> diff --git a/winbuild/psqlodbc.vcxproj b/winbuild/psqlodbc.vcxproj index e43698a..910f4ed 100755 --- a/winbuild/psqlodbc.vcxproj +++ b/winbuild/psqlodbc.vcxproj @@ -75,10 +75,12 @@ </Link> </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="$(MSDTC)"> - <Link> - <DelayLoadDLLs>$(DTCDLL).dll;%(DelayLoadDLLs)</DelayLoadDLLs> - </Link> + <!-- MSDTC --> + <ItemDefinitionGroup Condition="$(MSDTC)" > + <Link> + <DelayLoadDLLs>XOLEHLP.dll;%(DelayLoadDLLs)</DelayLoadDLLs> + <AdditionalDependencies>xolehlp.lib;%(AdditionalDependencies)</AdditionalDependencies> + </Link> </ItemDefinitionGroup> <ItemDefinitionGroup> @@ -95,11 +97,6 @@ </ResourceCompile> </ItemDefinitionGroup> - <Target Name="BuildImportLib"> - <MakeDir Directories="$(OutDir)"/> - <Exec command='lib /def:$(MAINDEF) /machine:$(TARGET_CPU) /out:"$(OutDir)$(MAINDLL).lib"' /> - </Target> - <ItemGroup> <Text Include="ReadMe.txt" /> </ItemGroup> @@ -144,8 +141,12 @@ <ClCompile Include="$(srcPath)tuple.c" /> <ClCompile Include="$(srcPath)win_md5.c" /> <ClCompile Condition="!$(ANSI_VERSION)" Include="$(srcPath)win_unicode.c" /> - <ClCompile Condition="$(MSDTC)" Include="$(srcPath)xalibname.c" /> </ItemGroup> + <ItemGroup Condition="$(MSDTC)"> + <ClCompile Include="$(srcPath)xalibname.c" /> + <ClCompile Include="$(srcPath)msdtc_enlist.cpp" /> + </ItemGroup> + <ItemGroup> <ResourceCompile Include="$(srcPath)psqlodbc.rc" /> </ItemGroup> -- 2.0.0

view thread (4+ messages)  latest in thread

Message-ID: <53A57080.1070501@vmware.com>
Permalink:  ../53A57080.1070501@vmware.com/
Also on:    postgresql.org/message-id/53A57080.1070501@vmware.com

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-odbc@postgresql.org
  Cc: hlinnakangas@vmware.com, inoue@tpf.co.jp
  Subject: Re: Why separate pgenlist DLL?
  In-Reply-To: <53A57080.1070501@vmware.com>
  References: <539F2D15.9020604@vmware.com> <53A0054A.5050508@tpf.co.jp> <53A57080.1070501@vmware.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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