| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 | 7 |
| 8 // This file defines a cross-platform "NativeLibrary" type which represents | 8 // This file defines a cross-platform "NativeLibrary" type which represents |
| 9 // a loadable module. | 9 // a loadable module. |
| 10 | 10 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 NativeLibraryLoadError* error); | 84 NativeLibraryLoadError* error); |
| 85 | 85 |
| 86 // Loads a native library from disk. Release it with UnloadNativeLibrary when | 86 // Loads a native library from disk. Release it with UnloadNativeLibrary when |
| 87 // you're done. Returns NULL on failure. | 87 // you're done. Returns NULL on failure. |
| 88 // If |error| is not NULL, it may be filled in on load error. | 88 // If |error| is not NULL, it may be filled in on load error. |
| 89 BASE_EXPORT NativeLibrary LoadNativeLibraryWithOptions( | 89 BASE_EXPORT NativeLibrary LoadNativeLibraryWithOptions( |
| 90 const FilePath& library_path, | 90 const FilePath& library_path, |
| 91 const NativeLibraryOptions& options, | 91 const NativeLibraryOptions& options, |
| 92 NativeLibraryLoadError* error); | 92 NativeLibraryLoadError* error); |
| 93 | 93 |
| 94 #if defined(OS_WIN) | |
| 95 // Loads a native library from disk. Release it with UnloadNativeLibrary when | |
| 96 // you're done. | |
| 97 // This function retrieves the LoadLibrary function exported from kernel32.dll | |
| 98 // and calls it instead of directly calling the LoadLibrary function via the | |
| 99 // import table. | |
| 100 BASE_EXPORT NativeLibrary LoadNativeLibraryDynamically( | |
| 101 const FilePath& library_path); | |
| 102 #endif // OS_WIN | |
| 103 | |
| 104 // Unloads a native library. | 94 // Unloads a native library. |
| 105 BASE_EXPORT void UnloadNativeLibrary(NativeLibrary library); | 95 BASE_EXPORT void UnloadNativeLibrary(NativeLibrary library); |
| 106 | 96 |
| 107 // Gets a function pointer from a native library. | 97 // Gets a function pointer from a native library. |
| 108 BASE_EXPORT void* GetFunctionPointerFromNativeLibrary(NativeLibrary library, | 98 BASE_EXPORT void* GetFunctionPointerFromNativeLibrary(NativeLibrary library, |
| 109 StringPiece name); | 99 StringPiece name); |
| 110 | 100 |
| 111 // Returns the full platform specific name for a native library. | 101 // Returns the full platform specific name for a native library. |
| 112 // |name| must be ASCII. | 102 // |name| must be ASCII. |
| 113 // For example: | 103 // For example: |
| 114 // "mylib" returns "mylib.dll" on Windows, "libmylib.so" on Linux, | 104 // "mylib" returns "mylib.dll" on Windows, "libmylib.so" on Linux, |
| 115 // "libmylib.dylib" on Mac. | 105 // "libmylib.dylib" on Mac. |
| 116 BASE_EXPORT std::string GetNativeLibraryName(StringPiece name); | 106 BASE_EXPORT std::string GetNativeLibraryName(StringPiece name); |
| 117 | 107 |
| 118 } // namespace base | 108 } // namespace base |
| 119 | 109 |
| 120 #endif // BASE_NATIVE_LIBRARY_H_ | 110 #endif // BASE_NATIVE_LIBRARY_H_ |
| OLD | NEW |