Hello,
I follow the website
http://honeypod.blogspot.com/2007/12/dynamically-linked-hello-world-for.html
and successfully dynamically link a shared library for Android.
But I want to know how to dynamically load a share library for
android?
I wrote two simple code to test
(1) Hello.c
#include <stdio.h>
void hello(const char *name){
  printf("Hello %s\n",name); }

(2) myTest.c
#include<stdio.h>
#include<stdlib.h>
#include<dlfcn.h>
int main(){
  void *handle;
  void (*f)(const char *name);
  char *error;
  char *string = "./libmyHello.so";
  printf("begin\n");
  handle = dlopen(string,RTLD_LAZY);
  if(!handle){
    fputs(dlerror(),stderr);
    exit(1);      }
  f = dlsym(handle, "hello");
    if((error=dlerror())!=NULL){
    fputs(error, stderr);
    exit(1);      }
  f("world!!");
  dlclose(handle);
  printf("end\n");
  return 0; }

I use "arm-none-linux-gnueabi-gcc –static myTest.c -ldl" to make
dynamically load executable
and
"arm-none-linux-gnueabi-gcc -fPIC -c hello.c"
"arm-none-linux-gnueabi-gcc -shared -Wl,-soname,libmylib.so -o
libmylib.so hello.o"
to build shared library

And push them to Android emulator, but I got an error message "Libc.so.
6: cannot open shared object file: No such file or directory"

Is there anything wrong?
Furthermore, If I want to make Dalvik VM dynamically load a library,
how to achieve this?
Thank you.
Any help would be helpful.



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

Reply via email to