Address Windows build errors, most config-dependent.#568
Conversation
* In the absence of an external SQLGetPrivateProfileString, fail the build only when expecting to use an external driver manager, and expose tds_SQLGetPrivateProfileString to the odbc "connect" unit test. Don't let that test attempt to use SQLGetPrivateProfileStringW even in Unicode builds. * src/odbc/win*.c: Accommodate static builds, with no hinstFreeTDS; in particular, never attempt to show FreeTDS dialog boxes there. * src/utils/unittests/challenge.c: #include <freetds/sysdep_private.h> to ensure the availability of strcasecmp. Signed-off-by: Aaron M. Ucko <ucko@ncbi.nlm.nih.gov>
| #if !HAVE_SQLGETPRIVATEPROFILESTRING | ||
|
|
||
| #ifdef _WIN32 | ||
| #if defined(_WIN32) && !defined(TDS_NO_DM) |
There was a problem hiding this comment.
Personally I would avoid this, Windows has a standard driver manager which should be used
|
I acknowledge that bypassing Windows' native DM is unconventional, but it's logistically simpler to use driverless mode everywhere than to arrange to link this API's tests directly against it only in the absence of a system DM. (The C++ Toolkit's build system covers bundled projects itself rather than using their own build systems.) I also seem to recall that the system DM insisted on sticking to drivers that had been registered system-wide, but perhaps that's not actually a problem, at least nowadays. |
|
Reasonable. About the UPDATE: other parts of the |
|
AFAICT, that part of the test does actually succeed with this change in place, at least if I point the test at appropriate |
| #if !HAVE_SQLGETPRIVATEPROFILESTRING | ||
| # define SQLGetPrivateProfileString tds_SQLGetPrivateProfileString | ||
| int tds_SQLGetPrivateProfileString(LPCSTR pszSection, LPCSTR pszEntry, | ||
| LPCSTR pszDefault, LPSTR pRetBuffer, | ||
| int nRetBuffer, LPCSTR pszFileName); |
There was a problem hiding this comment.
What happens if we use a DLL here? I would assume this test will refer to an undefined symbol and fail to load.
There was a problem hiding this comment.
Ah, yeah, (conditional) exporting is in order here. However, I need a static build anyway for the sake of the all_types, connection_string_parse, and utf8_4 tests, so our Windows builds leave this library static-only for simplicity.
There was a problem hiding this comment.
Tried to sort out this last hunk. Maybe code for that specific function could be just duplicated somehow? I tried to build for Windows and SQLGetPrivateProfileString from odbc system libraries was used, not the version from shared library.
|
I've added CMake tuneups I'd missed earlier and rebased against |
|
Merged |
to ensure the availability of strcasecmp.
Split from #555.