1 // Scintilla source code edit control
2 /** @file ScintillaDLL.cxx
3  ** DLL entry point for Scintilla.
4  **/
5 // Copyright 1998-2018 by Neil Hodgson <neilh@scintilla.org>
6 // The License.txt file describes the conditions under which this software may be distributed.
7 
8 #undef _WIN32_WINNT
9 #define _WIN32_WINNT 0x0500
10 #undef WINVER
11 #define WINVER 0x0500
12 #include <windows.h>
13 
14 #include "Scintilla.h"
15 #include "ScintillaWin.h"
16 
17 extern "C"
18 __declspec(dllexport)
Scintilla_DirectFunction(ScintillaWin * sci,UINT iMessage,uptr_t wParam,sptr_t lParam)19 sptr_t __stdcall Scintilla_DirectFunction(
20     ScintillaWin *sci, UINT iMessage, uptr_t wParam, sptr_t lParam) {
21 	return Scintilla::DirectFunction(sci, iMessage, wParam, lParam);
22 }
23 
DllMain(HINSTANCE hInstance,DWORD dwReason,LPVOID lpvReserved)24 extern "C" int APIENTRY DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpvReserved) {
25 	//Platform::DebugPrintf("Scintilla::DllMain %d %d\n", hInstance, dwReason);
26 	if (dwReason == DLL_PROCESS_ATTACH) {
27 		if (!Scintilla_RegisterClasses(hInstance))
28 			return FALSE;
29 	} else if (dwReason == DLL_PROCESS_DETACH) {
30 		if (lpvReserved == NULL) {
31 			Scintilla::ResourcesRelease(true);
32 		}
33 	}
34 	return TRUE;
35 }
36