Question

I have been given a Shared Object file (.so) and the functions inside of it, but I don't have a clue as to how to use it, or alter it for use in an iOS application. Could someone point me in the right direction?

I know the .so came from an Android application, but I was told I could get it to work in an iOS application as well.

Was it helpful?

Solution

Actually and technically, yes, you can, but not in a way you would ever think.

If it came from Android, it is probably compiled for ARM. So it should be binary-compatible with the ARM CPU in iOS devices. However, iOS doesn't use the usual format of shared objects (that is, the ELF format), but iOS' and OS X's own Mach-O format.

This means that you cannot directly link against this shared object file nor are you able pass it directly to dlopen() and dlsym(). You have to get into serious hacking (something that you probably don't know). This involves loading and relocating the file properly.

An example of this can be found in iOS jailbreak developer and hacker, Comex's GitHub repository Frash, a Flash player for jailbroken iOS devices. Comex essentially wrote an ELF loader module (dubbed "food") for iOS and used it to make Android's libflashplayer.so work on iOS. Pretty neat, huh?

Also note that this is not going to be possible for AppStore apps as it needs dynamic loading and various alterations in the OS.

OTHER TIPS

while technically possible (see h2co3's answer) for anything practical the answer is no

  • so files arent in the correct binary format
  • even if they were, dynamic loading is not allowed by appstore
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top