Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(880)

Side by Side Diff: base/native_library.h

Issue 115896: Making the browser tests work on Unix (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
11 #include "build/build_config.h" 11 #include "build/build_config.h"
12 12
13 #if defined(OS_WIN) 13 #if defined(OS_WIN)
14 #include <windows.h> 14 #include <windows.h>
15 #elif defined(OS_MACOSX) 15 #elif defined(OS_MACOSX)
16 #import <Carbon/Carbon.h> 16 #import <Carbon/Carbon.h>
17 #endif // OS_* 17 #endif // OS_*
18 18
19 #include "base/string16.h"
20
21 // Macro usefull for writing cross-platform function pointers.
22 #if defined(OS_WIN) && !defined(CDECL)
23 #define CDECL __cdecl
24 #else
25 #define CDECL
26 #endif
27
19 class FilePath; 28 class FilePath;
20 29
21 namespace base { 30 namespace base {
22 31
23 #if defined(OS_WIN) 32 #if defined(OS_WIN)
24 typedef HMODULE NativeLibrary; 33 typedef HMODULE NativeLibrary;
25 typedef char* NativeLibraryFunctionNameType;
26 #elif defined(OS_MACOSX) 34 #elif defined(OS_MACOSX)
27 typedef CFBundleRef NativeLibrary; 35 enum NativeLibraryType {
28 typedef CFStringRef NativeLibraryFunctionNameType; 36 BUNDLE,
37 DYNAMIC_LIB
38 };
39 struct NativeLibraryStruct {
40 NativeLibraryType type;
41 union {
42 CFBundleRef bundle;
43 void* dylib;
44 };
45 };
46 typedef NativeLibraryStruct* NativeLibrary;
29 #elif defined(OS_LINUX) 47 #elif defined(OS_LINUX)
30 typedef void* NativeLibrary; 48 typedef void* NativeLibrary;
31 typedef const char* NativeLibraryFunctionNameType;
32 #endif // OS_* 49 #endif // OS_*
33 50
34 // Loads a native library from disk. Release it with UnloadNativeLibrary when 51 // Loads a native library from disk. Release it with UnloadNativeLibrary when
35 // you're done. 52 // you're done.
36 NativeLibrary LoadNativeLibrary(const FilePath& library_path); 53 NativeLibrary LoadNativeLibrary(const FilePath& library_path);
37 54
38 // Unloads a native library. 55 // Unloads a native library.
39 void UnloadNativeLibrary(NativeLibrary library); 56 void UnloadNativeLibrary(NativeLibrary library);
40 57
41 // Gets a function pointer from a native library. 58 // Gets a function pointer from a native library.
42 void* GetFunctionPointerFromNativeLibrary(NativeLibrary library, 59 void* GetFunctionPointerFromNativeLibrary(NativeLibrary library,
43 NativeLibraryFunctionNameType name); 60 const char* name);
61
62 // Returns the full platform specific name for a native library.
63 // For example:
64 // "mylib" returns "mylib.dll" on Windows, "libmylib.so" on Linux,
65 // "mylib.dylib" on Mac.
66 string16 GetNativeLibraryName(const string16& name);
44 67
45 } // namespace base 68 } // namespace base
46 69
47 #endif // BASE_NATIVE_LIBRARY_H_ 70 #endif // BASE_NATIVE_LIBRARY_H_
OLDNEW
« no previous file with comments | « base/command_line.cc ('k') | base/native_library_linux.cc » ('j') | chrome/chrome.gyp » ('J')

Powered by Google App Engine
This is Rietveld 408576698