OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2009 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. | |
4 | |
5 #include "base/native_library.h" | |
6 | |
7 #include <dlfcn.h> | |
8 | |
9 #include "base/file_path.h" | |
10 #include "base/logging.h" | |
11 | |
12 namespace base { | |
13 | |
14 // static | |
jam
2009/04/21 00:26:53
nit: i know some places of the code do it often, b
| |
15 NativeLibrary LoadNativeLibrary(const FilePath& library_path) { | |
16 void* dl = dlopen(library_path.value().c_str(), RTLD_LAZY); | |
17 if (!dl) | |
18 NOTREACHED() << "dlopen failed: " << dlerror(); | |
19 | |
20 return dl; | |
21 } | |
22 | |
23 // static | |
24 void UnloadNativeLibrary(NativeLibrary library) { | |
25 int ret = dlclose(library); | |
26 if (ret < 0) | |
27 NOTREACHED() << "dlclose failed: " << dlerror(); | |
28 } | |
29 | |
30 // static | |
31 void* GetFunctionPointerFromNativeLibrary(NativeLibrary library, | |
32 NativeLibraryFunctionNameType name) { | |
33 return dlsym(library, name); | |
34 } | |
35 | |
36 } // namespace base | |
OLD | NEW |