diff --git a/src/win/wsystem.c b/src/win/wsystem.c
index 45008c4..9a54b1c 100644
--- a/src/win/wsystem.c
+++ b/src/win/wsystem.c
@@ -31,7 +31,7 @@
 #endif
 
 /* DMC requires a DllMain() function, or else the DLL hangs. */
-#ifndef ALLEGRO_STATICLINK
+#if !defined(ALLEGRO_STATICLINK) && defined(ALLEGRO_DMC)
 BOOL APIENTRY DllMain(HANDLE hModule, DWORD ul_reason, LPVOID lpReserved)
 {
    return TRUE;
