1 //===- Win32/DynamicLibrary.cpp - Win32 DL Implementation -------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file was developed by Reid Spencer and is distributed under the
6 // University of Illinois Open Source License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file provides the Win32 specific implementation of the DynamicLibrary
12 //===----------------------------------------------------------------------===//
19 //===----------------------------------------------------------------------===//
20 //=== WARNING: Implementation here must contain only Win32 specific code
21 //=== and must not be UNIX code
22 //===----------------------------------------------------------------------===//
24 DynamicLibrary::DynamicLibrary(const char*filename) : handle(0) {
25 handle = LoadLibrary(filename);
29 // FIXME: This should use FormatMessage
30 sprintf(Buffer, "Windows error code %d\n", GetLastError());
31 throw std::string(Buffer);
35 DynamicLibrary::~DynamicLibrary() {
40 void *DynamicLibrary::GetAddressOfSymbol(const char *symbolName) {
41 assert(handle !=0 && "Invalid DynamicLibrary handle");
42 return GetProcAddress(handle, symbolName);
47 // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab