diff -r bb434e6d3f9b cppcheck.suppress
--- a/cppcheck.suppress	Wed Mar 28 14:22:20 2018 +1100
+++ b/cppcheck.suppress	Thu Mar 29 20:24:12 2018 +1100
@@ -15,9 +15,6 @@
 // code legibility.
 passedByValue
 
-// The three private methods DefWndProc, ScrollText, and ModifyScrollBars are called by superclasses
-unusedPrivateFunction:scintilla/win32/ScintillaWin.cxx
-
 // Suppress most lexer warnings since the lexers are maintained by others
 redundantCondition:scintilla/lexers/LexA68k.cxx
 useInitializationList:scintilla/lexers/LexAsm.cxx
diff -r bb434e6d3f9b scripts/HeaderOrder.txt
--- a/scripts/HeaderOrder.txt	Wed Mar 28 14:22:20 2018 +1100
+++ b/scripts/HeaderOrder.txt	Thu Mar 29 20:24:12 2018 +1100
@@ -155,6 +155,7 @@
 // win32
 #include "PlatWin.h"
 #include "HanjaDic.h"
+#include "ScintillaWin.h"
 
 // gtk
 #include "ScintillaGTK.h"
diff -r bb434e6d3f9b win32/SciLexer.vcxproj
--- a/win32/SciLexer.vcxproj	Wed Mar 28 14:22:20 2018 +1100
+++ b/win32/SciLexer.vcxproj	Thu Mar 29 20:24:12 2018 +1100
@@ -118,6 +118,7 @@
     <ClCompile Include="..\win32\HanjaDic.cxx" />
     <ClCompile Include="..\win32\PlatWin.cxx" />
     <ClCompile Include="..\win32\ScintillaWin.cxx" />
+    <ClCompile Include="..\win32\ScintillaDLL.cxx" />
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\include\*.h" />
diff -r bb434e6d3f9b win32/ScintillaDLL.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/win32/ScintillaDLL.cxx	Thu Mar 29 20:24:12 2018 +1100
@@ -0,0 +1,35 @@
+// Scintilla source code edit control
+/** @file ScintillaDLL.cxx
+ ** DLL entry point for Scintilla.
+ **/
+// Copyright 1998-2018 by Neil Hodgson <neilh@scintilla.org>
+// The License.txt file describes the conditions under which this software may be distributed.
+
+#undef _WIN32_WINNT
+#define _WIN32_WINNT 0x0500
+#undef WINVER
+#define WINVER 0x0500
+#include <windows.h>
+
+#include "Scintilla.h"
+#include "ScintillaWin.h"
+
+extern "C"
+__declspec(dllexport)
+sptr_t __stdcall Scintilla_DirectFunction(
+    ScintillaWin *sci, UINT iMessage, uptr_t wParam, sptr_t lParam) {
+	return Scintilla::DirectFunction(sci, iMessage, wParam, lParam);
+}
+
+extern "C" int APIENTRY DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpvReserved) {
+	//Platform::DebugPrintf("Scintilla::DllMain %d %d\n", hInstance, dwReason);
+	if (dwReason == DLL_PROCESS_ATTACH) {
+		if (!Scintilla_RegisterClasses(hInstance))
+			return FALSE;
+	} else if (dwReason == DLL_PROCESS_DETACH) {
+		if (lpvReserved == NULL) {
+			Scintilla::ResourcesRelease(true);
+		}
+	}
+	return TRUE;
+}
diff -r bb434e6d3f9b win32/ScintillaWin.cxx
--- a/win32/ScintillaWin.cxx	Wed Mar 28 14:22:20 2018 +1100
+++ b/win32/ScintillaWin.cxx	Thu Mar 29 20:24:12 2018 +1100
@@ -90,6 +90,7 @@
 
 #include "PlatWin.h"
 #include "HanjaDic.h"
+#include "ScintillaWin.h"
 
 #ifndef SPI_GETWHEELSCROLLLINES
 #define SPI_GETWHEELSCROLLLINES   104
@@ -3383,15 +3384,15 @@
 	return reinterpret_cast<ScintillaWin *>(ptr)->WndProc(iMessage, wParam, lParam);
 }
 
-extern "C"
-#ifndef STATIC_BUILD
-__declspec(dllexport)
-#endif
-sptr_t __stdcall Scintilla_DirectFunction(
+namespace Scintilla {
+
+sptr_t DirectFunction(
     ScintillaWin *sci, UINT iMessage, uptr_t wParam, sptr_t lParam) {
 	return sci->WndProc(iMessage, wParam, lParam);
 }
 
+}
+
 LRESULT PASCAL ScintillaWin::SWndProc(
 	HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam) {
 	//Platform::DebugPrintf("S W:%x M:%x WP:%x L:%x\n", hWnd, iMessage, wParam, lParam);
@@ -3436,28 +3437,17 @@
 	return result;
 }
 
-static int ResourcesRelease(bool fromDllMain) {
+namespace Scintilla {
+
+int ResourcesRelease(bool fromDllMain) {
 	const bool result = ScintillaWin::Unregister();
 	Platform_Finalise(fromDllMain);
 	return result;
 }
 
+}
+
 // This function is externally visible so it can be called from container when building statically.
 int Scintilla_ReleaseResources() {
-	return ResourcesRelease(false);
+	return Scintilla::ResourcesRelease(false);
 }
-
-#ifndef STATIC_BUILD
-extern "C" int APIENTRY DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpvReserved) {
-	//Platform::DebugPrintf("Scintilla::DllMain %d %d\n", hInstance, dwReason);
-	if (dwReason == DLL_PROCESS_ATTACH) {
-		if (!Scintilla_RegisterClasses(hInstance))
-			return FALSE;
-	} else if (dwReason == DLL_PROCESS_DETACH) {
-		if (lpvReserved == NULL) {
-			ResourcesRelease(true);
-		}
-	}
-	return TRUE;
-}
-#endif
diff -r bb434e6d3f9b win32/ScintillaWin.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/win32/ScintillaWin.h	Thu Mar 29 20:24:12 2018 +1100
@@ -0,0 +1,15 @@
+// Scintilla source code edit control
+/** @file ScintillaWin.h
+ ** Define functions from ScintillaWin.cxx that can be called from SctinillaDLL.cxx.
+ **/
+// Copyright 1998-2018 by Neil Hodgson <neilh@scintilla.org>
+// The License.txt file describes the conditions under which this software may be distributed.
+
+class ScintillaWin;
+
+namespace Scintilla {
+
+int ResourcesRelease(bool fromDllMain);
+sptr_t DirectFunction(ScintillaWin *sci, UINT iMessage, uptr_t wParam, sptr_t lParam);
+
+}
\ No newline at end of file
diff -r bb434e6d3f9b win32/deps.mak
--- a/win32/deps.mak	Wed Mar 28 14:22:20 2018 +1100
+++ b/win32/deps.mak	Thu Mar 29 20:24:12 2018 +1100
@@ -2,6 +2,7 @@
 HanjaDic.o: HanjaDic.cxx ../src/UniConversion.h HanjaDic.h
 PlatWin.o: PlatWin.cxx ../include/Platform.h ../lexlib/StringCopy.h \
  ../src/XPM.h ../src/UniConversion.h ../src/DBCS.h ../src/FontQuality.h
+ScintillaDLL.o: ScintillaDLL.cxx
 ScintillaWin.o: ScintillaWin.cxx ../include/Platform.h \
  ../include/ILoader.h ../include/Sci_Position.h ../include/ILexer.h \
  ../include/Scintilla.h ../lexlib/StringCopy.h ../src/Position.h \
diff -r bb434e6d3f9b win32/makefile
--- a/win32/makefile	Wed Mar 28 14:22:20 2018 +1100
+++ b/win32/makefile	Thu Mar 29 20:24:12 2018 +1100
@@ -114,7 +114,7 @@
 	XPM.o \
 	HanjaDic.o
 
-SOBJS = ScintillaWin.o ScintillaBase.o $(BASEOBJS)
+SOBJS = ScintillaDLL.o ScintillaWin.o ScintillaBase.o $(BASEOBJS)
 
 # Required by lexers
 LEXLIBOBJS=\
@@ -138,10 +138,10 @@
 $(COMPONENT): $(SOBJS) Scintilla.def
 	$(CXX) $(LDFLAGS) -o $@ $(STRIPFLAG) $(SOBJS) $(CXXFLAGS) $(LIBS)
 
-$(LEXCOMPONENT): ScintillaWinL.o $(SCILEXOBJS) Scintilla.def
-	$(CXX) $(LDFLAGS) -o $@ $(STRIPFLAG) ScintillaWinL.o $(SCILEXOBJS) $(CXXFLAGS) $(LIBS)
+$(LEXCOMPONENT): ScintillaDLL.o ScintillaWinL.o $(SCILEXOBJS) Scintilla.def
+	$(CXX) $(LDFLAGS) -o $@ $(STRIPFLAG) ScintillaDLL.o ScintillaWinL.o $(SCILEXOBJS) $(CXXFLAGS) $(LIBS)
 
-$(LIBSCI): ScintillaWinS.o $(SCILEXOBJS)
+$(LIBSCI): ScintillaWin.o $(SCILEXOBJS)
 	$(AR) rc $@ $^
 	$(RANLIB) $@
 
@@ -173,22 +173,9 @@
  LexerModule.h Catalogue.h CaseConvert.h \
  CaseFolder.h
 
-ScintillaWinS.o: ScintillaWin.cxx Platform.h \
- ILexer.h Scintilla.h SplitVector.h \
- Partitioning.h RunStyles.h ContractionState.h \
- CellBuffer.h CallTip.h KeyMap.h Indicator.h \
- XPM.h LineMarker.h Style.h AutoComplete.h \
- ViewStyle.h CharClassify.h Decoration.h \
- Document.h Selection.h PositionCache.h \
- EditModel.h Editor.h EditView.h ScintillaBase.h UniConversion.h \
- CaseConvert.h CaseFolder.h
-
 ScintillaBaseL.o:
 	$(CXX) $(CXXFLAGS) -D SCI_LEXER -c $< -o $@
 
-ScintillaWinS.o:
-	$(CXX) $(CXXFLAGS) -D STATIC_BUILD -c $< -o $@
-
 ScintillaWinL.o:
 	$(CXX) $(CXXFLAGS) -D SCI_LEXER -c $< -o $@
 
diff -r bb434e6d3f9b win32/scintilla.mak
--- a/win32/scintilla.mak	Wed Mar 28 14:22:20 2018 +1100
+++ b/win32/scintilla.mak	Thu Mar 29 20:24:12 2018 +1100
@@ -106,7 +106,8 @@
 SOBJS=\
 	$(BASEOBJS) \
 	$(DIR_O)\ScintillaBase.obj \
-	$(DIR_O)\ScintillaWin.obj
+	$(DIR_O)\ScintillaWin.obj \
+	$(DIR_O)\ScintillaDLL.obj
 
 #++Autogenerated -- run scripts/LexGen.py to regenerate
 #**LEXOBJS=\\\n\(\t$(DIR_O)\\\*.obj \\\n\)
@@ -245,10 +246,10 @@
 $(COMPONENT): $(SOBJS) $(DIR_O)\ScintRes.res
 	$(LD) $(LDFLAGS) -DEF:Scintilla.def -DLL -OUT:$@ $** $(LIBS)
 
-$(LEXCOMPONENT): $(SCILEXOBJS) $(DIR_O)\ScintillaWinL.obj $(DIR_O)\ScintRes.res
+$(LEXCOMPONENT): $(SCILEXOBJS) $(DIR_O)\ScintillaDLL.obj $(DIR_O)\ScintillaWinL.obj $(DIR_O)\ScintRes.res
 	$(LD) $(LDFLAGS) -DEF:Scintilla.def -DLL -OUT:$@ $** $(LIBS)
 
-$(LIBSCI): $(SCILEXOBJS) $(DIR_O)\ScintillaWinS.obj
+$(LIBSCI): $(SCILEXOBJS) $(DIR_O)\ScintillaWin.obj
 	LIB /OUT:$@ $**
 
 # Define how to build all the objects and what they depend on
@@ -269,9 +270,6 @@
 $(DIR_O)\ScintillaWinL.obj: ScintillaWin.cxx
 	$(CXX) $(CXXFLAGS) -DSCI_LEXER -c $(NAME)$@ ScintillaWin.cxx
 
-$(DIR_O)\ScintillaWinS.obj: ScintillaWin.cxx
-	$(CXX) $(CXXFLAGS) -DSTATIC_BUILD -c $(NAME)$@ ScintillaWin.cxx
-
 # Dependencies
 
 # All lexers depend on this set of headers
@@ -965,6 +963,8 @@
 	../src/Editor.h \
 	../src/AutoComplete.h \
 	../src/ScintillaBase.h
+$(DIR_O)\ScintillaDLL.obj: \
+	ScintillaDLL.cxx
 $(DIR_O)\ScintillaWin.obj: \
 	ScintillaWin.cxx \
 	../include/Platform.h \
@@ -1039,43 +1039,6 @@
 	../src/ScintillaBase.h \
 	PlatWin.h \
 	HanjaDic.h
-$(DIR_O)\ScintillaWinS.obj: \
-	ScintillaWin.cxx \
-	../include/Platform.h \
-	../include/ILoader.h \
-	../include/Sci_Position.h \
-	../include/ILexer.h \
-	../include/Scintilla.h \
-	../lexlib/StringCopy.h \
-	../src/Position.h \
-	../src/UniqueString.h \
-	../src/SplitVector.h \
-	../src/Partitioning.h \
-	../src/RunStyles.h \
-	../src/ContractionState.h \
-	../src/CellBuffer.h \
-	../src/CallTip.h \
-	../src/KeyMap.h \
-	../src/Indicator.h \
-	../src/LineMarker.h \
-	../src/Style.h \
-	../src/ViewStyle.h \
-	../src/CharClassify.h \
-	../src/Decoration.h \
-	../src/CaseFolder.h \
-	../src/Document.h \
-	../src/CaseConvert.h \
-	../src/UniConversion.h \
-	../src/Selection.h \
-	../src/PositionCache.h \
-	../src/EditModel.h \
-	../src/MarginView.h \
-	../src/EditView.h \
-	../src/Editor.h \
-	../src/AutoComplete.h \
-	../src/ScintillaBase.h \
-	PlatWin.h \
-	HanjaDic.h
 $(DIR_O)\Selection.obj: \
 	../src/Selection.cxx \
 	../include/Platform.h \
