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

Side by Side Diff: src/trusted/plugin/dylib_unittest.cc

Issue 7799028: Remove src/trusted/plugin (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: fix gyp file for necessary -I Created 9 years, 3 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
« no previous file with comments | « src/trusted/plugin/dylib_unittest.h ('k') | src/trusted/plugin/file_downloader.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2010 The Native Client Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can
3 // be found in the LICENSE file.
4
5 #include "native_client/src/trusted/plugin/dylib_unittest.h"
6
7 #include <stdio.h>
8
9 #if NACL_WINDOWS
10 DylibHandle DylibOpen(const char* lib_path) {
11 return LoadLibrary(lib_path);
12 }
13
14 bool DylibClose(DylibHandle dl_handle) {
15 return FreeLibrary(dl_handle) == TRUE;
16 }
17
18 SymbolHandle GetSymbolHandle(DylibHandle dl_handle, const char* name) {
19 return reinterpret_cast<SymbolHandle>(GetProcAddress(dl_handle, name));
20 }
21 #else
22 DylibHandle DylibOpen(const char* lib_path) {
23 // By using RTLD_NOW we check that all symbols are resolved before the
24 // dlopen completes, or it fails.
25 return dlopen(lib_path, RTLD_NOW | RTLD_LOCAL);
26 }
27
28 bool DylibClose(DylibHandle dl_handle) {
29 return dlclose(dl_handle) == 0;
30 }
31
32 SymbolHandle GetSymbolHandle(DylibHandle dl_handle, const char* name) {
33 void* sym_handle = dlsym(dl_handle, name);
34 char* error_string = dlerror();
35 if (sym_handle == NULL || error_string != NULL) {
36 fprintf(stderr, "Couldn't get symbol %s: %s\n", name, error_string);
37 sym_handle = NULL;
38 }
39 return reinterpret_cast<SymbolHandle>(sym_handle);
40 }
41 #endif
OLDNEW
« no previous file with comments | « src/trusted/plugin/dylib_unittest.h ('k') | src/trusted/plugin/file_downloader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698