aboutsummaryrefslogtreecommitdiffhomepage
path: root/win32/PlatWin.cxx
diff options
context:
space:
mode:
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);
}