| 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 |
| 11 #include "base/base_export.h" | 11 #include "base/base_export.h" |
| 12 #include "build/build_config.h" | 12 #include "build/build_config.h" |
| 13 | 13 |
| 14 #if defined(OS_WIN) | 14 #if defined(OS_WIN) |
| 15 #include <windows.h> | 15 #include <windows.h> |
| 16 #elif defined(OS_MACOSX) | 16 #elif defined(OS_MACOSX) |
| 17 #include "base/files/file_path.h" |
| 17 #import <CoreFoundation/CoreFoundation.h> | 18 #import <CoreFoundation/CoreFoundation.h> |
| 18 #endif // OS_* | 19 #endif // OS_* |
| 19 | 20 |
| 20 #include "base/string16.h" | 21 #include "base/string16.h" |
| 21 | 22 |
| 22 // Macro useful for writing cross-platform function pointers. | 23 // Macro useful for writing cross-platform function pointers. |
| 23 #if defined(OS_WIN) && !defined(CDECL) | 24 #if defined(OS_WIN) && !defined(CDECL) |
| 24 #define CDECL __cdecl | 25 #define CDECL __cdecl |
| 25 #else | 26 #else |
| 26 #define CDECL | 27 #define CDECL |
| 27 #endif | 28 #endif |
| 28 | 29 |
| 29 namespace base { | 30 namespace base { |
| 30 | 31 |
| 31 class FilePath; | 32 class FilePath; |
| 32 | 33 |
| 33 #if defined(OS_WIN) | 34 #if defined(OS_WIN) |
| 34 typedef HMODULE NativeLibrary; | 35 typedef HMODULE NativeLibrary; |
| 35 #elif defined(OS_MACOSX) | 36 #elif defined(OS_MACOSX) |
| 36 enum NativeLibraryType { | 37 enum NativeLibraryType { |
| 37 BUNDLE, | 38 BUNDLE, |
| 38 DYNAMIC_LIB | 39 DYNAMIC_LIB |
| 39 }; | 40 }; |
| 40 struct NativeLibraryStruct { | 41 struct NativeLibraryStruct { |
| 41 NativeLibraryType type; | 42 NativeLibraryType type; |
| 42 CFBundleRefNum bundle_resource_ref; | 43 CFBundleRefNum bundle_resource_ref; |
| 44 base::FilePath image_path; |
| 43 union { | 45 union { |
| 44 CFBundleRef bundle; | 46 CFBundleRef bundle; |
| 45 void* dylib; | 47 void* dylib; |
| 46 }; | 48 }; |
| 47 }; | 49 }; |
| 48 typedef NativeLibraryStruct* NativeLibrary; | 50 typedef NativeLibraryStruct* NativeLibrary; |
| 49 #elif defined(OS_POSIX) | 51 #elif defined(OS_POSIX) |
| 50 typedef void* NativeLibrary; | 52 typedef void* NativeLibrary; |
| 51 #endif // OS_* | 53 #endif // OS_* |
| 52 | 54 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 76 | 78 |
| 77 // Returns the full platform specific name for a native library. | 79 // Returns the full platform specific name for a native library. |
| 78 // For example: | 80 // For example: |
| 79 // "mylib" returns "mylib.dll" on Windows, "libmylib.so" on Linux, | 81 // "mylib" returns "mylib.dll" on Windows, "libmylib.so" on Linux, |
| 80 // "mylib.dylib" on Mac. | 82 // "mylib.dylib" on Mac. |
| 81 BASE_EXPORT string16 GetNativeLibraryName(const string16& name); | 83 BASE_EXPORT string16 GetNativeLibraryName(const string16& name); |
| 82 | 84 |
| 83 } // namespace base | 85 } // namespace base |
| 84 | 86 |
| 85 #endif // BASE_NATIVE_LIBRARY_H_ | 87 #endif // BASE_NATIVE_LIBRARY_H_ |
| OLD | NEW |