diff options
author | Jeff Cohen <jeffc@jolt-lang.org> | 2004-12-09 05:51:11 +0000 |
---|---|---|
committer | Jeff Cohen <jeffc@jolt-lang.org> | 2004-12-09 05:51:11 +0000 |
commit | 31127e1d89efe440d761497f29dbe646b23a2806 (patch) | |
tree | 082e63488b304c767537b68afb46905414c0c322 /lib/System/Win32/DynamicLibrary.cpp | |
parent | b6a0d3595b15731e025a094880c7a85dee06e93c (diff) |
Fix residual Visual Studio build problems
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18688 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/System/Win32/DynamicLibrary.cpp')
-rw-r--r-- | lib/System/Win32/DynamicLibrary.cpp | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/lib/System/Win32/DynamicLibrary.cpp b/lib/System/Win32/DynamicLibrary.cpp index d743454746..cc3376eedf 100644 --- a/lib/System/Win32/DynamicLibrary.cpp +++ b/lib/System/Win32/DynamicLibrary.cpp @@ -12,7 +12,6 @@ //===----------------------------------------------------------------------===// #include "Win32.h" -#include <windef.h> namespace llvm { using namespace sys; @@ -23,33 +22,30 @@ using namespace sys; //===----------------------------------------------------------------------===// DynamicLibrary::DynamicLibrary() : handle(0) { - handle = new HMODULE; - *((HMODULE*)handle) = GetModuleHandle(NULL); + handle = (void*) GetModuleHandle(NULL); - if (*((HMODULE*)handle) == 0) { + if (handle == 0) { ThrowError("Can't GetModuleHandle: "); } } DynamicLibrary::DynamicLibrary(const char*filename) : handle(0) { - handle = new HMODULE; - *((HMODULE*)handle) = LoadLibrary(filename); + handle = LoadLibrary(filename); - if (*((HMODULE*)handle) == 0) { + if (handle == 0) { ThrowError("Can't LoadLibrary: "); } } DynamicLibrary::~DynamicLibrary() { assert(handle !=0 && "Invalid DynamicLibrary handle"); - if (*((HMODULE*)handle)) - FreeLibrary(*((HMODULE*)handle)); - delete (HMODULE*)handle; + if (handle) + FreeLibrary((HMODULE*)handle); } void *DynamicLibrary::GetAddressOfSymbol(const char *symbolName) { assert(handle !=0 && "Invalid DynamicLibrary handle"); - return (void*) GetProcAddress(*((HMODULE*)handle), symbolName); + return (void*) GetProcAddress((HMODULE*)handle, symbolName); } } |