diff --git a/src/utils/dllinit.c b/src/utils/dllinit.c
index 06fbdccc82538c49784450273bf896bb6c875802..03c07d1521cb857c766f7c33b0f11e9dfd38e637 100644
--- a/src/utils/dllinit.c
+++ b/src/utils/dllinit.c
@@ -1,3 +1,6 @@
+#include <cygwin/version.h>
+#if CYGWIN_VERSION_DLL_MAJOR < 1001
+
 /* dllinit.c -- Portable DLL initialization.
    Copyright (C) 1998 Free Software Foundation, Inc.
    Contributed by Mumit Khan (khan@xraylith.wisc.edu).
@@ -102,3 +105,5 @@ DllMain(
 	}
 	return TRUE;
 }
+
+#endif /* CYGWIN_VERSION_DLL_MAJOR < 1001 */