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

Side by Side Diff: third_party/android_crazy_linker/src/tests/zoo.cpp

Issue 322433006: Fork of the Android NDK crazy linker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add a required license header to a cpp module, missing in the original. Created 6 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
« no previous file with comments | « third_party/android_crazy_linker/src/tests/test_util.h ('k') | no next file » | 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 (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include <dlfcn.h>
6 #include <stdio.h>
7
8 extern "C" bool Zoo() {
9 printf("%s: Entering\n", __FUNCTION__);
10 void* bar_lib = dlopen("libbar.so", RTLD_NOW);
11 if (!bar_lib) {
12 fprintf(stderr, "Could not libbar.so: %s\n", dlerror());
13 return false;
14 }
15 printf("%s: Opened libbar.so @%p\n", __FUNCTION__, bar_lib);
16
17 void (*bar_func)();
18
19 bar_func = reinterpret_cast<void (*)()>(dlsym(bar_lib, "Bar"));
20 if (!bar_func) {
21 fprintf(stderr, "Could not find 'Bar' symbol in libbar.so\n");
22 return false;
23 }
24 printf("%s: Found 'Bar' symbol at @%p\n", __FUNCTION__, bar_func);
25
26 // Call it.
27 printf("%s: Calling Bar()\n", __FUNCTION__);
28 (*bar_func)();
29
30 printf("%s: Closing libbar.so\n", __FUNCTION__);
31 dlclose(bar_lib);
32
33 printf("%s: Exiting\n", __FUNCTION__);
34 return true;
35 }
OLDNEW
« no previous file with comments | « third_party/android_crazy_linker/src/tests/test_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698