Forums - Program hangs when dlclose() DSP stub shared library

1 post / 0 new
Program hangs when dlclose() DSP stub shared library
thlin
Join Date: 27 Mar 16
Posts: 1
Posted: Thu, 2016-05-19 07:55
Hello everyone,
 
I am using Hexagon SDK 2.0 on DragonBoard 810 bought from Intrinsyc Technologies.
I follow the instructions in Hexagon SDK document(${SDK_ROOT}\docs\Examples_Computer-Vision.html) and run cornerApp(${SDK_ROOT}\examples\fastcv\cornerApp) on DragonBoard 810 success.
But I found if I compile the cornerApp as a shared library(cornerApp.so) and write a simple program dlopen this shared library, I will get hang when dlclose().
The following simple modifications can reproduce the error:
1.Modify android.min: cornerApp build as shared library, build src/foo.c as executable
  1. # stub library  
  2. BUILD_DLLS += libcornerApp  
  3.   
  4. libcornerApp_QAICIDLS += \  
  5.    inc/cornerApp \  
  6.    $(MAKE_D_DSPCV_INCDIR)/dspCV \  
  7.   
  8. libcornerApp_C_SRCS += \  
  9.   $V/cornerApp_stub \  
  10.   $V/dspCV_stub \  
  11.   
  12. libcornerApp_DLLS += libadsprpc  
  13.   
  14. # stand-alone corner-detection executable  
  15. BUILD_DLLS += cornerApp  
  16.   
  17. cornerApp_QAICIDLS += \  
  18.  inc/cornerApp \  
  19.  $(MAKE_D_DSPCV_INCDIR)/dspCV \  
  20.   
  21. cornerApp_C_SRCS += src/cornerApp  
  22. cornerApp_LIBS += rpcmem  
  23. cornerApp_DLLS += libcornerApp \  
  24.                 libadsprpc \  
  25.                   
  26. cornerApp_LD_FLAGS += -llog  
  27. cornerApp_DEFINES += VERIFY_PRINT_ERROR  
  28.   
  29. BUILD_EXES += dlopen_test  
  30. dlopen_test_C_SRCS += src/foo  
  31. dlopen_test_LD_FLAGS += -ldl  
  32.   
  33. # copy final build products to the ship directory  
  34. BUILD_COPIES = \  
  35.    $(DLLS) \  
  36.    $(EXES) \  
  37.    $(LIBS) \  
  38.    $(SHIP_DIR)/ ;  
2.Add src/foo.c:
  1. #include <stdlib.h>  
  2. #include <stdio.h>  
  3. #include <dlfcn.h>  
  4.   
  5. int main(int argc, char **argv)   
  6. {  
  7.     void *handle;  
  8.     int (*test_main_start)(int argc, char* argv[]);  
  9.     char *error;  
  10.   
  11.     handle = dlopen ("cornerApp.so", RTLD_LAZY);  
  12.     if (!handle) {  
  13.         fputs (dlerror(), stderr);  
  14.         exit(1);  
  15.     }  
  16.   
  17.     test_main_start = dlsym(handle, "test_main_start");  
  18.     if ((error = (char *)dlerror()) != NULL)  {  
  19.         fputs(error, stderr);  
  20.         exit(1);  
  21.     }  
  22.   
  23.     printf ("test_main_start returned %d\n", (*test_main_start)(argc, argv));  
  24.     dlclose(handle);  
  25.     return 0;  

 

Does anyone know how to solve this problem?

  • Up0
  • Down0

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.