Skip to content

Commit d016cdd

Browse files
authored
Merge pull request #1166 from tleedjarv/msys-win-fix
Fix compilation on MSYS2
2 parents e6795df + 8da79b0 commit d016cdd

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

src/copy_stubs.c

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,25 @@
1515
along with this program. If not, see <http://www.gnu.org/licenses/>.
1616
*/
1717

18+
#ifdef _WIN32
19+
20+
/* Minimum Windows API needed for getting the definition of
21+
* struct DUPLICATE_EXTENTS_DATA with MinGW headers under MSYS2.
22+
* As of 2025-11, MSYS2 by default targets Windows 7, which is
23+
* not sufficient in this case. */
24+
#define WINVER 0x0603
25+
#define _WIN32_WINNT 0x0603 /* Windows 8.1 */
26+
27+
#ifndef UNICODE
28+
#define UNICODE
29+
#endif
30+
#ifndef _UNICODE
31+
#define _UNICODE
32+
#endif
33+
34+
#endif /* _WIN32 */
35+
36+
1837
#include <caml/memory.h>
1938
#include <caml/threads.h>
2039
#include <caml/unixsupport.h>
@@ -244,13 +263,6 @@ CAMLprim value unison_copy_file(value in_fd, value out_fd, value in_offs, value
244263
#elif defined(_WIN32)
245264

246265

247-
#ifndef UNICODE
248-
#define UNICODE
249-
#endif
250-
#ifndef _UNICODE
251-
#define _UNICODE
252-
#endif
253-
254266
#include <windows.h>
255267
#include <winioctl.h>
256268

0 commit comments

Comments
 (0)