Ok..
I have a problem of reading .so file via .a and my main application.
my main console application includes .a static library file, and a function in .a static library file reads .so file using dlopen() function.
My .so project is shared object that calls java source code using JNI. it compiles well and generate .so file.
My .a project is to read .so file using the function, dlopen(). it compiles well and generates .a file.
However, it got stopped at dlopen() function. it gets no pointer to my .so file. when I see my error using dlerror(), it says:
"fail to dlopen, libjvm.so: cannot open shared object file: No such file or directory"
I set LD_LIBRARY_PATH correctly, and I think that is why my .so project implementing JNI got compiled very well: I included correct include and library path of JDK for this .so project.
I am on Ubuntu 64bit and working on all console, .a, .so projects (total 3 project) using Netbeans IDE.
But interestingly, if I try to load that .so file in a just simple c program, it reads very well.
I do not know why following independent simple c program can read my .so file but my main project's console application cannot read via .a file.
here is source code of that simple c program:
#include <stdio.h>
#include <dlfcn.h>
int main(int argc, char **argv)
{
void *handle = NULL;
int (*result)(int, int);
handle = dlopen("/home/online0227/desktop/runDynamic/myso.so", RTLD_LAZY);
if ( !handle )
{
printf("fail to dlopen, %s\n", dlerror());
return 0;
} else {
printf("succeeded1111\n");
}
dlclose(handle);
return 0;
}
Here is what I typed to compile and run this simple C program:
gcc -o main main.c -ldl
./main