c++ - nm utility to get what is defined in .so file returns error -
i need symbols defined in .so file. use latest mac os , this:
/usr/bin/nm -gc libs/armeabi/libhello.so
error: /applications/xcode.app/contents/developer/toolchains/xcodedefault.xctoolchain/usr/bin/nm: invalid argument -c usage: /applications/xcode.app/contents/developer/toolchains/xcodedefault.xctoolchain/usr/bin/nm [-agnopruumxjlfap[s segname sectname] [-] [-t format] [[-arch ] ...] [file ...]
as understand nm utility? connected xcode? how fix issue?
edit: adding code .so file created.
#include <android/log.h> #include <stdio.h> #include <jni.h> jint nativeaddition(jnienv *penv, jobject pobj, jint pa, jint pb) { return pa+pb; } jint nativemultiplication(jnienv *penv, jobject pobj, jint pa, jint pb) { return pa*pb; } jniexport jint jnicall jni_onload(javavm* pvm, void* reserved) { jnienv* env; if ((*pvm)->getenv(pvm, (void **)&env, jni_version_1_6)) { return -1; } jninativemethod nm[2]; nm[0].name = "nativeaddition"; nm[0].signature = "(ii)i"; nm[0].fnptr = nativeaddition; nm[1].name = "nativemultiplication"; nm[1].signature = "(ii)i"; nm[1].fnptr = nativemultiplication; jclass cls = (*env)->findclass(env, "com/example/hellondk/hellondkactivity"); // register methods env->registernatives. (*env)->registernatives(env, cls, nm, 2); return jni_version_1_6; }
this example android native development kit cookbook.
and here usage message of nm
usage: /applications/xcode.app/contents/developer/toolchains/xcodedefault.xctoolchain/usr/bin/nm [-agnopruumxjlfap[s segname sectname] [-] [-t format] [[-arch ] ...] [file ...]
in os x -c
option demangling symbols absent.
# nm libs/armeabi/libhello.so | c++filt -p -i
you can instead use c++filt wrapper or invoke shown above.
Comments
Post a Comment