@@ -111,6 +111,7 @@ typedef struct H5E_t H5E_t;
111
111
/* Retrieve the error code description string and push it onto the error
112
112
* stack.
113
113
*/
114
+ #ifndef H5_HAVE_WIN32_API
114
115
#define HSYS_DONE_ERROR (majorcode , minorcode , retcode , str ) \
115
116
{ \
116
117
int myerrno = errno; \
@@ -129,6 +130,35 @@ typedef struct H5E_t H5E_t;
129
130
HGOTO_ERROR (majorcode , minorcode , retcode , "%s, errno = %d, error message = '%s'" , str , myerrno , \
130
131
HDstrerror (myerrno )); \
131
132
}
133
+ #else /* H5_HAVE_WIN32_API */
134
+ /* On Windows we also emit the result of GetLastError(). This call returns a DWORD, which is always a
135
+ * 32-bit unsigned type. Note that on Windows, either errno or GetLastError() (but probably not both) will
136
+ * be useful depending on whether a C/POSIX or Win32 call failed. The other value will likely be zero,
137
+ * though I wouldn't count on that.
138
+ */
139
+ #define HSYS_DONE_ERROR (majorcode , minorcode , retcode , str ) \
140
+ { \
141
+ int myerrno = errno; \
142
+ DWORD win_error = GetLastError(); \
143
+ /* Other projects may rely on the description format to get the errno and any changes should be \
144
+ * considered as an API change \
145
+ */ \
146
+ HDONE_ERROR (majorcode , minorcode , retcode , \
147
+ "%s, errno = %d, error message = '%s', Win32 GetLastError() = %" PRIu32 "" , str , \
148
+ myerrno , HDstrerror (myerrno ), win_error ); \
149
+ }
150
+ #define HSYS_GOTO_ERROR (majorcode , minorcode , retcode , str ) \
151
+ { \
152
+ int myerrno = errno; \
153
+ DWORD win_error = GetLastError(); \
154
+ /* Other projects may rely on the description format to get the errno and any changes should be \
155
+ * considered as an API change \
156
+ */ \
157
+ HGOTO_ERROR (majorcode , minorcode , retcode , \
158
+ "%s, errno = %d, error message = '%s', Win32 GetLastError() = %" PRIu32 "" , str , \
159
+ myerrno , HDstrerror (myerrno ), win_error ); \
160
+ }
161
+ #endif /* H5_HAVE_WIN32_API */
132
162
133
163
#ifdef H5_HAVE_PARALLEL
134
164
/*
0 commit comments