| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include <dlfcn.h> | 8 #include <dlfcn.h> |
| 9 #include <stdio.h> | 9 #include <stdio.h> |
| 10 | 10 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 // find the address of the main function | 91 // find the address of the main function |
| 92 int (*app_main)(int, const char**); | 92 int (*app_main)(int, const char**); |
| 93 *(void **) (&app_main) = dlsym(appLibrary, "main"); | 93 *(void **) (&app_main) = dlsym(appLibrary, "main"); |
| 94 | 94 |
| 95 if (!app_main) { | 95 if (!app_main) { |
| 96 printf("ERROR: Unable to load the main function of the selected program.
\n"); | 96 printf("ERROR: Unable to load the main function of the selected program.
\n"); |
| 97 printf("ERROR: %s\n", dlerror()); | 97 printf("ERROR: %s\n", dlerror()); |
| 98 return -1; | 98 return -1; |
| 99 } | 99 } |
| 100 | 100 |
| 101 // find the address of the SkPrintToConsole function | |
| 102 void (*app_SkDebugToStdOut)(bool); | |
| 103 *(void **) (&app_SkDebugToStdOut) = dlsym(skiaLibrary, "AndroidSkDebugToStdO
ut"); | |
| 104 | |
| 105 if (app_SkDebugToStdOut) { | |
| 106 (*app_SkDebugToStdOut)(true); | |
| 107 } else { | |
| 108 printf("WARNING: Unable to redirect output to the console.\n"); | |
| 109 printf("WARNING: %s\n", dlerror()); | |
| 110 } | |
| 111 | |
| 112 // pass all additional arguments to the main function | 101 // pass all additional arguments to the main function |
| 113 return launch_app(app_main, argc - 1, ++argv); | 102 return launch_app(app_main, argc - 1, ++argv); |
| 114 } | 103 } |
| OLD | NEW |