BridJ can not find the methods of a shared library. I need help with understanding why.
The library was generated by JNAerator.
mn -g
of lib.so:
w _Jv_RegisterClasses
U _Unwind_Resume@@GCC_3.0
00004970 T _Z11CreateClassv
00004960 T _Z11DeleteClassPv
....
Header of the library:
#ifdef __cplusplus
extern "C" {
#endif;
void* CreateClass(void);
void DeleteClass(void* hClass);
....
Java code:
@Runtime(CRuntime.class)
public class MobileclientLibrary {
static {
BridJ.register();
}
public static Pointer<? > CreateClass() {
return Pointer.pointerToAddress(CreateClass$2());
}
@Ptr
@Name("CreateClass")
protected native static long CreateClass$2();
public static void DeleteClass(Pointer<? > hClass) {
DeleteClass(Pointer.getPeer(hClass));
}
protected native static void DeleteClass(@Ptr long hClass);
...
When run this application in the logs:
Mar 12, 2013 2:13:53 PM org.bridj.BridJ log
INFO: Failed to get address of method protected static native void Mobileclient.MobileclientLibrary.DeleteClass(long)
But method CreateClass
is successfully found.
Why is that?
This error message means there is a method declared in your header but not implemented in your library. Verify that
DeleteClass()
is in fact implemented in the library JNAerator is referencing.