summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2015-02-22 11:39:08 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2015-02-22 11:39:08 (GMT)
commit85a644221848b047a46bdcff5f3371d690a2f55a (patch)
tree05b3bec8882e5dc6896d641b1edb6d08bca41875
parent0ecf47141483e63a02f8b2f3b9d9c790a3ff4b63 (diff)
downloadhdf5-85a644221848b047a46bdcff5f3371d690a2f55a.zip
hdf5-85a644221848b047a46bdcff5f3371d690a2f55a.tar.gz
hdf5-85a644221848b047a46bdcff5f3371d690a2f55a.tar.bz2
[svn-r26273] Fixes compile failures when building on Windows when UNICODE is defined.
This was due to wrapping a variable with the TEXT() macro and not forcing the <function>A form of certain Win32 API calls are always used. Although we do not defined UNICODE in our builds, others have encountered problems when building HDF5 as a part of a larger project where UNICODE is defined. Fix for: HDFFV-8927 Tested on: 64-bit Windows 7, Visual Studio 2012, CMake 3.2 All combinations of static/shared and UNICODE defined/undefined NOTE: plugin tests are skipped with static builds
-rw-r--r--release_docs/RELEASE.txt23
-rw-r--r--src/H5PL.c33
2 files changed, 44 insertions, 12 deletions
diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt
index 879ec2d..08f1397 100644
--- a/release_docs/RELEASE.txt
+++ b/release_docs/RELEASE.txt
@@ -154,6 +154,29 @@ Bug Fixes since HDF5-1.8.14
transform the list to a series of -D{value} for the compile.
(ADB - 2014/12/09, HDFV-9041)
+
+ - Fixed compile errors on Windows w/ Visual Studio and CMake when
+ UNICODE is defined.
+
+ The HDF5 library could not be built on Windows with Visual Studio when
+ UNICODE was defined. This was due to incorrect use of the TEXT() macro
+ and some Win32 API functions that take TCHAR parameters. The faulty
+ code was a part of the filter plugin functionality. This was a
+ compile-time error that only affected users who build HDF5 from source
+ and define UNICODE, usually when HDF5 is being built as a part of a
+ larger product. There were no run-time effects.
+
+ These errors caused no problems when UNICODE was not defined. HDF5 is
+ normally not built with UNICODE defined and the binaries were
+ unaffected.
+
+ The fix was to remove the TEXT() macro and explicitly use the
+ 'A' form of the Win32 API calls, which expect char strings instead of
+ wchar_t strings.
+
+ Note that HDF5 currently does not support Unicode file paths on Windows.
+
+ (DER - 2015/02/22, HDFFV-8927)
Parallel Library
----------------
diff --git a/src/H5PL.c b/src/H5PL.c
index c178cf8..96a4415 100644
--- a/src/H5PL.c
+++ b/src/H5PL.c
@@ -29,8 +29,6 @@
#include "H5PLprivate.h" /* Plugin */
#include "H5Zprivate.h" /* Filter pipeline */
-#ifndef H5_VMS
-
/****************/
/* Local Macros */
/****************/
@@ -41,7 +39,19 @@
/* Macros for supporting
* both Windows and Unix */
/****************************/
-/* Windows support */
+/* Windows support
+ *
+ * SPECIAL WINDOWS NOTE
+ *
+ * Some of the Win32 API functions expand to fooA or fooW depending on
+ * whether UNICODE or _UNICODE are defined. You MUST explicitly use
+ * the A version of the functions to force char * behavior until we
+ * work out a scheme for proper Windows Unicode support.
+ *
+ * If you do not do this, people will be unable to incorporate our
+ * source code into their own CMake builds if they define UNICODE.
+ */
+
#ifdef H5_HAVE_WIN32_API
#define H5PL_PATH_SEPARATOR ";"
@@ -50,7 +60,7 @@
#define H5PL_HANDLE HINSTANCE
/* Get a handle to a plugin library. Windows: TEXT macro handles Unicode strings */
-#define H5PL_OPEN_DLIB(S) LoadLibraryEx(TEXT(S), NULL, LOAD_WITH_ALTERED_SEARCH_PATH)
+#define H5PL_OPEN_DLIB(S) LoadLibraryExA(S, NULL, LOAD_WITH_ALTERED_SEARCH_PATH)
/* Get the address of a symbol in dynamic library */
#define H5PL_GET_LIB_FUNC(H,N) GetProcAddress(H,N)
@@ -458,17 +468,17 @@ done:
static htri_t
H5PL__find(H5PL_type_t plugin_type, int type_id, char *dir, const void **info)
{
- WIN32_FIND_DATA fdFile;
- HANDLE hFind;
- char *pathname = NULL;
- char service[2048];
- htri_t ret_value = FALSE;
+ WIN32_FIND_DATAA fdFile;
+ HANDLE hFind;
+ char *pathname = NULL;
+ char service[2048];
+ htri_t ret_value = FALSE;
FUNC_ENTER_STATIC
/* Specify a file mask. *.* = We want everything! */
sprintf(service, "%s\\*.dll", dir);
- if((hFind = FindFirstFile(service, &fdFile)) == INVALID_HANDLE_VALUE)
+ if((hFind = FindFirstFileA(service, &fdFile)) == INVALID_HANDLE_VALUE)
HGOTO_ERROR(H5E_PLUGIN, H5E_OPENERROR, FAIL, "can't open directory")
do {
@@ -499,7 +509,7 @@ H5PL__find(H5PL_type_t plugin_type, int type_id, char *dir, const void **info)
HDassert(pathname);
pathname = (char *)H5MM_xfree(pathname);
} /* end if */
- } while(FindNextFile(hFind, &fdFile)); /* Find the next file. */
+ } while(FindNextFileA(hFind, &fdFile)); /* Find the next file. */
done:
if(hFind)
@@ -669,4 +679,3 @@ H5PL__close(H5PL_HANDLE handle)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5PL__close() */
-#endif /*H5_VMS*/