• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2015 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4 
5 #include <stdint.h>
6 #include <stdio.h>
7 #include <dlfcn.h>
8 
9 // Tests "main.main" is exported on android/arm,
10 // which golang.org/x/mobile/app depends on.
main(int argc,char ** argv)11 int main(int argc, char** argv) {
12   void* handle = dlopen(argv[1], RTLD_LAZY | RTLD_GLOBAL);
13   if (!handle) {
14     fprintf(stderr, "ERROR: failed to open the shared library: %s\n",
15             dlerror());
16     return 2;
17   }
18 
19   uintptr_t main_fn = (uintptr_t)dlsym(handle, "main.main");
20   if (!main_fn) {
21     fprintf(stderr, "ERROR: missing main.main: %s\n", dlerror());
22     return 2;
23   }
24 
25   // TODO(hyangah): check that main.main can run.
26 
27   printf("PASS\n");
28   return 0;
29 }
30