7

I want to see source code of shared object library (so) file in android. how can i convert .so binary file to native c/c++ code.

Riyas Ahamed
  • 119
  • 1
  • 1
  • 3
  • http://stackoverflow.com/questions/2306972/is-there-any-way-to-decompile-linux-so – iosdude Oct 15 '16 at 09:30
  • The source is not part of binary files. You can *decompile* the binary code, but it will not be the original source code, and will not really be readable. – Some programmer dude Oct 15 '16 at 09:30
  • 2
    In general you can't. – Jacques de Hooge Oct 15 '16 at 09:38
  • You may not know that Android is built on top of Linux. So you're, in effect, asking to decompile a Linux so file. That's why link by @iosdude is relevant. You might also check this answer: http://stackoverflow.com/questions/205059/is-there-a-c-decompiler – Hod Oct 15 '16 at 09:44
  • a dis-assembler application would give you assembly code, but nothing will go back to the original c (or c++) code – user3629249 Oct 15 '16 at 17:48

1 Answers1

2

The purpose of making an so file is to NOT share the source code, no matter if it is android or not. This is intentionally designed this way so as not to open the design. Following this, many firms share .so file (machine instructions) keeping their design confidential.

However, if you are keen to know what the .so file contains, you may read the ELF (Executable and Linkable Format) of the library. command

readelf -a yourLibraryName.so > yourLibraryName_elf.txt

The output contains symbol table. You may search for the function names, global variables etc from the generated text file.

More details of the contects here http://www.skyfree.org/linux/references/ELF_Format.pdf