Attachment "abinumbers.patch" to
ticket [9edc58a665]
added by
chw
2020-07-23 04:12:55.
Index: generic/odbcStubInit.c
==================================================================
--- generic/odbcStubInit.c
+++ generic/odbcStubInit.c
@@ -141,10 +141,13 @@
/* Handle to a load module */
SQLConfigDataSourceW = NULL;
SQLConfigDataSource = NULL;
SQLInstallerError = NULL;
+#if !defined(_WIN32) && !defined(__APPLE__) && !defined(__OpenBSD__)
+ int abiNum = 2;
+#endif
/*
* Determine the shared library extension
*/
status = Tcl_EvalEx(interp, "::info sharedlibextension", -1,
@@ -155,13 +158,24 @@
/*
* Walk the list of possible library names to find an ODBC client
*/
status = TCL_ERROR;
+#if !defined(_WIN32) && !defined(__APPLE__) && !defined(__OpenBSD__)
+again:
+#endif
for (i = 0; status == TCL_ERROR && odbcStubLibNames[i] != NULL; ++i) {
path = Tcl_NewStringObj(odbcStubLibNames[i], -1);
Tcl_AppendObjToObj(path, shlibext);
+#if !defined(_WIN32) && !defined(__APPLE__) && !defined(__OpenBSD__)
+ if (abiNum != 0) {
+ char abiBuffer[16];
+
+ sprintf(abiBuffer, ".%d", abiNum);
+ Tcl_AppendObjToObj(path, Tcl_NewStringObj(abiBuffer, -1));
+ }
+#endif
Tcl_IncrRefCount(path);
Tcl_ResetResult(interp);
/*
* Try to load a client library and resolve the ODBC API within it.
@@ -168,19 +182,34 @@
*/
status = Tcl_LoadFile(interp, path, odbcSymbolNames, 0,
(void*)odbcStubs, &handle);
Tcl_DecrRefCount(path);
}
+#if !defined(_WIN32) && !defined(__APPLE__) && !defined(__OpenBSD__)
+ if (status == TCL_ERROR) {
+ if (--abiNum >= 0) {
+ goto again;
+ }
+ }
+#endif
/*
* If a client library is found, then try to load ODBCINST as well.
*/
if (status == TCL_OK) {
int status2 = TCL_ERROR;
for (i = 0; status2 == TCL_ERROR && odbcOptLibNames[i] != NULL; ++i) {
path = Tcl_NewStringObj(odbcOptLibNames[i], -1);
Tcl_AppendObjToObj(path, shlibext);
+#if !defined(_WIN32) && !defined(__APPLE__) && !defined(__OpenBSD__)
+ if (abiNum != 0) {
+ char abiBuffer[16];
+
+ sprintf(abiBuffer, ".%d", abiNum);
+ Tcl_AppendObjToObj(path, Tcl_NewStringObj(abiBuffer, -1));
+ }
+#endif
Tcl_IncrRefCount(path);
status2 = Tcl_LoadFile(interp, path, NULL, 0, NULL, handle2Ptr);
if (status2 == TCL_OK) {
SQLConfigDataSourceW =
(BOOL (INSTAPI*)(HWND, WORD, LPCWSTR, LPCWSTR))