1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "base/scoped_native_library.h"
9 void NativeLibraryTraits::Free(NativeLibrary library) {
10 UnloadNativeLibrary(library);
13 using BaseClass = ScopedGeneric<NativeLibrary, NativeLibraryTraits>;
15 ScopedNativeLibrary::ScopedNativeLibrary() : BaseClass(), error_() {}
17 ScopedNativeLibrary::~ScopedNativeLibrary() = default;
19 ScopedNativeLibrary::ScopedNativeLibrary(NativeLibrary library)
20 : BaseClass(library), error_() {}
22 ScopedNativeLibrary::ScopedNativeLibrary(const FilePath& library_path)
23 : ScopedNativeLibrary() {
24 reset(LoadNativeLibrary(library_path, &error_));
27 ScopedNativeLibrary::ScopedNativeLibrary(ScopedNativeLibrary&& scoped_library)
28 : BaseClass(scoped_library.release()), error_() {}
30 void* ScopedNativeLibrary::GetFunctionPointer(const char* function_name) const {
33 return GetFunctionPointerFromNativeLibrary(get(), function_name);
36 const NativeLibraryLoadError* ScopedNativeLibrary::GetError() const {