Knu

Forum Replies Created

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • in reply to: [Android] Debugging NDK make libraries #2580
    Knu
    Participant

    that sounds reasonable, i remember i read about the sharedlibrary command but i didn’t actually remembered to try it :facepalm:

    thanks again!

    in reply to: [Android] Debugging NDK make libraries #2578
    Knu
    Participant

    Hi,

    thanks for your fast answer. Sorry if my english was a little shaky on my previous post: i wrote it after a LONG day 😀

    However, i did what you suggested and it looks like i can include my own library now. I created a new project (Set to NOT update Android.mk automatically this time) and added to Android.mk

    
    include $(CLEAR_VARS)
    LOCAL_MODULE := libsandBoxTestAndroid-prebuilt
    LOCAL_SRC_FILES := ../../Android/Debug/libsandBoxTestAndroid.so
    include $(PREBUILT_SHARED_LIBRARY)
    

    and changed Application.mk to

    
    APP_ABI := armeabi-v7a
    

    If i check the built APK, i can see that in lib/armeabi-v7a/ finally there is libsandBoxTestAndroid.so – great!

    I then tried to load the library by editing the C source file from the wizard

    	char szBuf[512];
    sprintf(szBuf, "You have pressed this huge button %d times", s_ButtonPressCounter++);
    
    void * myLibHandle;
    myLibHandle = dlopen("libsandBoxTestAndroid.so", RTLD_NOW );
    
    if(!myLibHandle)
    sprintf(szBuf, "%s", dlerror() );

    however dlopen() is not happy

    Cannot load library: load_library[1091]: Library libsandBoxTestAndroid.so not found

    unless i specify its absolute path

    myLibHandle = dlopen("/data/data/com.visualgdb.example.NativeVSAndroidProject/lib/libsandBoxTestAndroid.so", RTLD_NOW );

    But googling it looks like it’s a common issue? sorry for the offtopic, but maybe this comes in handy to somebody in the future (i’ll bother you more in the future, i guess 😀 )

    Thanks again!

    EDIT: i still have a question though – how come my breakpoints in source from the static libraries are never considered by GDB?

Viewing 2 posts - 1 through 2 (of 2 total)