Loading more than one library per native call
843829Sep 17 2010 — edited Sep 20 2010Hi all,
I never really used forums before, but now I am really stuck... Ok I have a java application that needs to load several c++ libraries.
The C++ libraries are supposed to do the following
libA.so prints Hello A.
libB.so prints Hello B.
Java Classes
abstract class Master
{
public abstract void testeMyFunction(String name);
}
class A extends Master
{
A(String lib)
{
System.load(lib);
}
public native void testeMyFunction(String name);
}
public class Main
{
public static void main(String[] args) throws Exception
{
A a =new A("/home/filipe/workspace/TESTES/myTeste/Debug/libA.so");
a.testeMyFunction("Lib");
A b = new A("/home/filipe/workspace/TESTES/myTeste2/Debug/libB.so");
b.testeMyFunction("Lib");
}
}
The expected output should be:
Hello A
Hello B
However the result is Hello A Hello A :(
I believe its because it is binding the native call to the first System.load (in this case libA.so) and therefore its not loading the second library properly... Is there anyway you guys can recommend to have the desired output?
Thanks a million,
Filipe
Edited by: TonyCarreira on Sep 17, 2010 8:24 AM