1 //===-- DynamicLibrary.cpp ------------------------------------------*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 #include "lldb/Core/Error.h" 11 #include "lldb/Host/DynamicLibrary.h" 12 13 using namespace lldb_private; 14 DynamicLibrary(const FileSpec & spec,uint32_t options)15DynamicLibrary::DynamicLibrary (const FileSpec& spec, uint32_t options) : m_filespec(spec) 16 { 17 Error err; 18 m_handle = Host::DynamicLibraryOpen (spec,options,err); 19 if (err.Fail()) 20 m_handle = NULL; 21 } 22 23 bool IsValid()24DynamicLibrary::IsValid () 25 { 26 return m_handle != NULL; 27 } 28 ~DynamicLibrary()29DynamicLibrary::~DynamicLibrary () 30 { 31 if (m_handle) 32 Host::DynamicLibraryClose (m_handle); 33 } 34