| 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 | 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 26 matching lines...) Expand all  Loading... | 
| 37   DYNAMIC_LIB | 37   DYNAMIC_LIB | 
| 38 }; | 38 }; | 
| 39 struct NativeLibraryStruct { | 39 struct NativeLibraryStruct { | 
| 40   NativeLibraryType type; | 40   NativeLibraryType type; | 
| 41   union { | 41   union { | 
| 42     CFBundleRef bundle; | 42     CFBundleRef bundle; | 
| 43     void* dylib; | 43     void* dylib; | 
| 44   }; | 44   }; | 
| 45 }; | 45 }; | 
| 46 typedef NativeLibraryStruct* NativeLibrary; | 46 typedef NativeLibraryStruct* NativeLibrary; | 
| 47 #elif defined(OS_LINUX) | 47 #elif defined(OS_LINUX) || defined(OS_OPENBSD) | 
| 48 typedef void* NativeLibrary; | 48 typedef void* NativeLibrary; | 
| 49 #endif  // OS_* | 49 #endif  // OS_* | 
| 50 | 50 | 
| 51 // Loads a native library from disk.  Release it with UnloadNativeLibrary when | 51 // Loads a native library from disk.  Release it with UnloadNativeLibrary when | 
| 52 // you're done. | 52 // you're done. | 
| 53 NativeLibrary LoadNativeLibrary(const FilePath& library_path); | 53 NativeLibrary LoadNativeLibrary(const FilePath& library_path); | 
| 54 | 54 | 
| 55 // Unloads a native library. | 55 // Unloads a native library. | 
| 56 void UnloadNativeLibrary(NativeLibrary library); | 56 void UnloadNativeLibrary(NativeLibrary library); | 
| 57 | 57 | 
| 58 // Gets a function pointer from a native library. | 58 // Gets a function pointer from a native library. | 
| 59 void* GetFunctionPointerFromNativeLibrary(NativeLibrary library, | 59 void* GetFunctionPointerFromNativeLibrary(NativeLibrary library, | 
| 60                                           const char* name); | 60                                           const char* name); | 
| 61 | 61 | 
| 62 // Returns the full platform specific name for a native library. | 62 // Returns the full platform specific name for a native library. | 
| 63 // For example: | 63 // For example: | 
| 64 // "mylib" returns "mylib.dll" on Windows, "libmylib.so" on Linux, | 64 // "mylib" returns "mylib.dll" on Windows, "libmylib.so" on Linux, | 
| 65 // "mylib.dylib" on Mac. | 65 // "mylib.dylib" on Mac. | 
| 66 string16 GetNativeLibraryName(const string16& name); | 66 string16 GetNativeLibraryName(const string16& name); | 
| 67 | 67 | 
| 68 }  // namespace base | 68 }  // namespace base | 
| 69 | 69 | 
| 70 #endif  // BASE_NATIVE_LIBRARY_H_ | 70 #endif  // BASE_NATIVE_LIBRARY_H_ | 
| OLD | NEW | 
|---|