Search code examples
c#cshared-librariesartoolkitnm

nm: shared library symbol appearing twice or once


I have a shared library (libARWrapper.so) which includes the following two entries, shown using nm (nm -D --defined-only libARWrapper.so)

00075854 T Java_org_artoolkit_ar_base_NativeInterface_arwAcceptVideoImage
00074d54 T Java_org_artoolkit_ar_base_NativeInterface_arwCapture
...
00072d54 T arwCapture

I know that T means "The symbol is in the text (code) section."

What is the distinction between arwCapture appearing twice, and arwAcceptVideoImage, which appears only once.

I am able to call arwCapture from a C# DllImport, but not arwAcceptVideoImage.
There are also many other functions appearing the same as arwCapture, all under org.artoolkit.ar.bash.NativeInterface, which I can use OK.
Other (Java) code is able to call all functions through the NDK.


Solution

  • In the posted output from nm there is no evidence of what you state (arwCapture() does not appear twice). One is the JNI function which is surely a wrapper that calls arwCapture() at some point.

    Presumably arwCapture() is a c function which is why you can call it from C#, but in the shared object, there is no arwAcceptVideoImage() anywhere although there is a Java arwAcceptVideoImage() method defined.

    If this shared object is intended as a JNI object, you should avoid calling it from another language but Java. Instead find the original library and use it.