aboutsummaryrefslogtreecommitdiffhomepage
path: root/win32/PlatWin.cxx
diff options
context:
space:
mode:
authornyamatongwe <devnull@localhost>2003-04-18 01:39:55 +0000
committernyamatongwe <devnull@localhost>2003-04-18 01:39:55 +0000
commit945fc56c783b1520f95531a73def4cbdcaa772a3 (patch)
tree60beced0238d3852a891da2629baac76c18657c2 /win32/PlatWin.cxx
parentfd50d41ef50c1f93921d2466449e53f0b4767e7c (diff)
downloadscintilla-mirror-945fc56c783b1520f95531a73def4cbdcaa772a3.tar.gz
Patch from Simon to make ExternalLexer platform independent.
Diffstat (limited to 'win32/PlatWin.cxx')
-rw-r--r--win32/PlatWin.cxx30
1 files changed, 30 insertions, 0 deletions
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx
index bf6112d57..c61a67ca9 100644
--- a/win32/PlatWin.cxx
+++ b/win32/PlatWin.cxx
@@ -1288,6 +1288,36 @@ double ElapsedTime::Duration(bool reset) {
return result;
}
+class DynamicLibraryImpl : public DynamicLibrary {
+protected:
+ HMODULE h;
+public:
+ DynamicLibraryImpl(const char *modulePath) {
+ h = ::LoadLibrary(modulePath);
+ }
+
+ virtual ~DynamicLibraryImpl() {
+ if (h != NULL)
+ ::FreeLibrary(h);
+ }
+
+ // Use GetProcAddress to get a pointer to the relevant function.
+ virtual Function *FindFunction(const char *name) {
+ if (h != NULL) {
+ return reinterpret_cast<Function*>( ::GetProcAddress(h, name) );
+ } else
+ return NULL;
+ }
+
+ virtual bool IsValid() {
+ return h != NULL;
+ }
+};
+
+DynamicLibrary *DynamicLibrary::Load(const char *modulePath) {
+ return static_cast<DynamicLibrary *>( new DynamicLibraryImpl(modulePath) );
+}
+
ColourDesired Platform::Chrome() {
return ::GetSysColor(COLOR_3DFACE);
}