OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef BASE_NATIVE_LIBRARY_H_ | 5 #ifndef BASE_NATIVE_LIBRARY_H_ |
6 #define BASE_NATIVE_LIBRARY_H_ | 6 #define BASE_NATIVE_LIBRARY_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 // This file defines a cross-platform "NativeLibrary" type which represents | 9 // This file defines a cross-platform "NativeLibrary" type which represents |
10 // a loadable module. | 10 // a loadable module. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 }; | 47 }; |
48 typedef NativeLibraryStruct* NativeLibrary; | 48 typedef NativeLibraryStruct* NativeLibrary; |
49 #elif defined(OS_POSIX) | 49 #elif defined(OS_POSIX) |
50 typedef void* NativeLibrary; | 50 typedef void* NativeLibrary; |
51 #endif // OS_* | 51 #endif // OS_* |
52 | 52 |
53 // Loads a native library from disk. Release it with UnloadNativeLibrary when | 53 // Loads a native library from disk. Release it with UnloadNativeLibrary when |
54 // you're done. | 54 // you're done. |
55 NativeLibrary LoadNativeLibrary(const FilePath& library_path); | 55 NativeLibrary LoadNativeLibrary(const FilePath& library_path); |
56 | 56 |
| 57 #if defined(OS_WIN) |
| 58 // Loads a native library from disk. Release it with UnloadNativeLibrary when |
| 59 // you're done. |
| 60 // This function retrieves the LoadLibrary function exported from kernel32.dll |
| 61 // and calls it instead of directly calling the LoadLibrary function via the |
| 62 // import table. |
| 63 NativeLibrary LoadNativeLibraryDynamically(const FilePath& library_path); |
| 64 #endif // OS_WIN |
| 65 |
57 // Unloads a native library. | 66 // Unloads a native library. |
58 void UnloadNativeLibrary(NativeLibrary library); | 67 void UnloadNativeLibrary(NativeLibrary library); |
59 | 68 |
60 // Gets a function pointer from a native library. | 69 // Gets a function pointer from a native library. |
61 void* GetFunctionPointerFromNativeLibrary(NativeLibrary library, | 70 void* GetFunctionPointerFromNativeLibrary(NativeLibrary library, |
62 const char* name); | 71 const char* name); |
63 | 72 |
64 // Returns the full platform specific name for a native library. | 73 // Returns the full platform specific name for a native library. |
65 // For example: | 74 // For example: |
66 // "mylib" returns "mylib.dll" on Windows, "libmylib.so" on Linux, | 75 // "mylib" returns "mylib.dll" on Windows, "libmylib.so" on Linux, |
67 // "mylib.dylib" on Mac. | 76 // "mylib.dylib" on Mac. |
68 string16 GetNativeLibraryName(const string16& name); | 77 string16 GetNativeLibraryName(const string16& name); |
69 | 78 |
70 } // namespace base | 79 } // namespace base |
71 | 80 |
72 #endif // BASE_NATIVE_LIBRARY_H_ | 81 #endif // BASE_NATIVE_LIBRARY_H_ |
OLD | NEW |