Home | History | Annotate | Download | only in jni
      1 /* A small program used to check that LOCAL_WHOLE_STATIC_LIBRARIES builds
      2  * and works properly. Here, we check that the 'foo2' function which is
      3  * never called from main is still included in the final executable
      4  * image.
      5  */
      6 #include <stdio.h>
      7 #include <dlfcn.h>
      8 
      9 int main(void)
     10 {
     11     void*  lib;
     12 
     13     lib = dlopen("/data/local/ndk-tests/libbar.so", RTLD_NOW);
     14     if (lib == NULL) {
     15         fprintf(stderr, "Could not dlopen(\"libbar.so\"): %s\n", dlerror());
     16         return 1;
     17     }
     18     if (dlsym(lib, "foo2") == NULL) {
     19         fprintf(stderr, "Symbol 'foo2' is missing from shared library!!\n");
     20         return 2;
     21     }
     22     dlclose(lib);
     23     return 0;
     24 }
     25