main3.c 785 B

1234567891011121314151617181920212223242526272829
  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. #include <stdint.h>
  5. #include <stdio.h>
  6. #include <dlfcn.h>
  7. // Tests "main.main" is exported on android/arm,
  8. // which golang.org/x/mobile/app depends on.
  9. int main(int argc, char** argv) {
  10. void* handle = dlopen(argv[1], RTLD_LAZY | RTLD_GLOBAL);
  11. if (!handle) {
  12. fprintf(stderr, "ERROR: failed to open the shared library: %s\n",
  13. dlerror());
  14. return 2;
  15. }
  16. uintptr_t main_fn = (uintptr_t)dlsym(handle, "main.main");
  17. if (!main_fn) {
  18. fprintf(stderr, "ERROR: missing main.main: %s\n", dlerror());
  19. return 2;
  20. }
  21. // TODO(hyangah): check that main.main can run.
  22. printf("PASS\n");
  23. return 0;
  24. }