diff --git a/docs/doxygen/mainpages/const_cpp.h b/docs/doxygen/mainpages/const_cpp.h
index 8b827cf3a3..9ae6d42f4f 100644
--- a/docs/doxygen/mainpages/const_cpp.h
+++ b/docs/doxygen/mainpages/const_cpp.h
@@ -36,7 +36,10 @@ using @ifdef_ and not @if_.
@itemdef{__WXMAC__, old define, same as @c __WXOSX__}
@itemdef{__WXMOTIF__, Motif}
@itemdef{__WXMOTIF20__, Motif 2.0 or higher}
-@itemdef{__WXMSW__, GUI using Windows Controls}
+@itemdef{__WXMSW__, GUI using Windows Controls.
+Notice that for compatibility reasons, this symbol is defined for console
+applications under Windows as well, but it should only be used in the GUI code
+while @c __WINDOWS__ should be used for the platform tests.}
@itemdef{__WXOSX__, OS X GUI using any Apple widget framework (Carbon, AppKit or UIKit)}
@itemdef{__WXOSX_IPHONE__, OS X iPhone (UIKit)}
@itemdef{__WXOSX_CARBON__, Mac OS X using Carbon}
diff --git a/include/wx/platform.h b/include/wx/platform.h
index 53b04e522d..97c669f7a4 100644
--- a/include/wx/platform.h
+++ b/include/wx/platform.h
@@ -95,8 +95,13 @@
# endif
#endif /* __WINDOWS__ */
-/* Don't use widget toolkit specific code in non-GUI code */
-#if defined(wxUSE_GUI) && !wxUSE_GUI
+/*
+ Don't use widget toolkit specific code in non-GUI code in the library
+ itself to ensure that the same base library is used for both MSW and GTK
+ ports. But keep __WXMSW__ defined for (console) applications using
+ wxWidgets for compatibility.
+ */
+#if defined(WXBUILDING) && defined(wxUSE_GUI) && !wxUSE_GUI
# ifdef __WXMSW__
# undef __WXMSW__
# endif