Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Situation: Long back i developed some coding in C and C++, by converting to *.SO file - i deleted those C and C++ files.

Issue: I want to re-convert the *.SO files into C and C++ files for the code upgradation, Please guide for the procedure and send any tutorial and procedure for re-conversion.

share|improve this question

closed as off topic by Kevin Bowen, vasa1, AgentCool, Eric Carvalho, Jorge Castro Mar 28 '13 at 13:28

Questions on Ask Ubuntu are expected to relate to Ubuntu within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

1  
This is a basic question that comes down to the limitations in basic programming tools. Furthermore, an answer involves explaining what an .so file is (which is platform-specific). And we have a good answer. Since "Development on Ubuntu" is explicitly on-topic in the FAQ, I have a hard time believing any basic question about tools and file types is off-topic (some development-related question has to be on-topic--if this one isn't, what is?); and with an upvoted answer, I see no advantage associated with having this closed. –  Eliah Kagan Mar 28 '13 at 15:49
add comment

1 Answer 1

up vote 4 down vote accepted

This question has been asked here before: http://stackoverflow.com/questions/2306972/is-there-any-way-to-decompile-linux-so.

Anyway, you can't get back your original code, or to quote Carlos Gutiérrez: "You can make hamburgers with a cow, but you can't make a cow with hamburgers".

A *.so file is a compiled shared object (roughly equivalent to a dll in windows). It contains all the information for a function in a language the machine understands. This is not necessarily the same language as the one it is written in - If the original was not pure assembly, it almost certainly isn't the same language. So while its possible to get back enough information to produce a function that does the same thing it is not possible to get back to the original source code.

share|improve this answer
    
Ha ha.. OK.. But,you you designed the procedure for conversion to *.SO similarly even you may be knowing the procedure for re-conversion right.. –  Naveen Mar 28 '13 at 7:53
    
@Naveen No. Information is lost going from source to object code. There is such a thing as a decompiler, but if you manage to get a decompiler to work on your .so file, it will generally still give you something that is looks entirely different from the source code you wrote, and which obfuscates the logical purpose of each part of the code. In other words, you might not gain much from any attempt at decompiling, beyond what you'd gain by disassembling and looking at the assembly. And of course, your code comments, formatting, and any constructions created for clarity are lost. –  Eliah Kagan Mar 28 '13 at 15:53
    
Or to put it more simply: Even the author of the compiler you used will not be able to construct your original source code (nor a reasonable facsimile) from object or executable/library code (in this case, your .so file). When you write a program in a language like Visual Basic 4.0, C#, or Java, where compilation consists of converting your code into a bytecode rather than the machine language of any actual machine, then decompiling is sometimes capable of producing something vaguely like what you started with. For C/C++, generally it cannot. –  Eliah Kagan Mar 28 '13 at 15:56
    
@Eliah Kagan, Thankyou very much for the well understandable answer.. –  Naveen Mar 29 '13 at 8:25
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.