Hi,

First of all the NDK is not providing support to load multiple shared
library at run-time!

The only way is load the depended so library manually in memory and then
call or do the required things as you want.  for example you want to call a
method of shared library called "main" with the method defined as " int
main(int argc, char** argv)"

Currently this only the best way to solve the loading of multiple shared
library problem in Android.

example....

void *lib_handle;
    int (*fnmain)(int, char **);
    char *error;

    lib_handle = dlopen("/data/data/com.mycompany.myproject/lib/libmain.so",
RTLD_LAZY);
    if (!lib_handle)
    {
        fprintf(stderr, "%s\n", dlerror());
        exit(1);
    }

    fnmain = dlsym(lib_handle, "main");
    if ((error = dlerror()) != NULL)
    {
        fprintf(stderr, "%s\n", error);
        exit(1);
    }

    ret = (*fnmain)(argc, argv);

    dlclose(lib_handle);


Ping me back if you have any trouble in that!

Sandeep Choudhary <http://mobi-solutions.blogspot.com/>
http://www.linkedin.com/in/sandeepchoudhary


On Thu, Mar 15, 2012 at 3:43 PM, Gaëtan de Villèle <[email protected]>wrote:

> Hi Alex,
>
> Unfortunately no...
> I haven't completely watched the android office hours ... but I haven't
> find my question in it.
>
> For the (game) project I'm working on, I've set all compilation static :(
> I don't know who to ask for dynamic libs loading ... :(
> (it's pretty hard to ask to an android guy, they are very busy)
>
> There is a Dynamic Loader API in android native API I think ... (check the
> NDK documentation.html file)
> http://en.wikipedia.org/wiki/Dynamic_loading
> (#include <dlfcn.h>)
> Maybe it's the solution ... but, to use the dynamic loader from scratch
> isn't cool at all !! ...
> (a lot of complicated code to get functions pointers etc)
>
> See you later
> Gaëtan
>
> PS : if you want to chat, my skype pseudo : *gaetan117*
>
>
> Le 15 mars 2012 à 10:57, alex a écrit :
>
> Hey Gaetan,
>
> any progress on this from your side?
>
> Thanks,
> Alex
>
>
> On Feb 13, 9:46 pm, Gaetan <[email protected]> wrote:
>
> Ah ! I'm not alone with this problem ^_^
>
>
> Yes, this is very strange ...
>
> To solve your problem with STL, you can link to STLPORT_STATIC in you
>
> Application.mk file, like this :
>
>
> --------------------copy here--------------------------
>
>
> APP_STL := stlport_static
>
>
> --------------------copy here--------------------------
>
>
> For the moment, I have solved my problem by compiling all other libs with
>
> STATIC linking.
>
> (entry lib is still shared, and others are static)
>
>
> For shared libraries, I haven't found. I have asked the question here :
> http://goo.gl/mod/DdlG(you can vote ;) )
>
> for the next Android Developers hangout in google+ (
> https://plus.google.com/108967384991768947849/posts)
>
> (next wednesday)
>
>
> best regards !! =)
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>
>
>  --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to