Domanda

libdvm.so inside of Android2.3, i can use the code to call dexFileParse code: void * handle=dlopen("/system/lib/libdvm.so",RTDL_LAZY); void *pFunc=dlsym(handle,"dexFileParse");


but libdvm.so exports _Z16dexFileParseXXX,i won't get the address of dexFileParse from dlsym(handle,"dexFileParse"). you say:you can dlsym(handle,"_Z16dexFileParseXXX"), yeah, it will be OK, but _Z16****XXX is renamed by the compiler of cplusplus,I can't use it when i don't know the compiler of cplusplus


How can i call the dexFileParse?

thanks

È stato utile?

Soluzione

The symbol changed when the source code was changed from .c to .cpp. The dexFileParse function is part of libdex, and is not public. Not only can't you rely on the name mangling having a specific value, you can't rely on the fact that the function exists or works as you expect it to.

If using a private API is acceptable for your use case, then probing for the function with dlsym (i.e. try dexFileParse, then _Z16dexFileParseXXX) should be fine. If this isn't acceptable, then you should try to find a public API that handles the problem you're trying to solve.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top