2

I'm sure there's a way. I'm new to C and my research on this led me nowhere. Is there a command that can convert a .o file to .c?

1
  • 3
    Hi Tony, that isn't easily possible. It's called 'decompilation' and unfortunately it's not a simple process. Commented Mar 21, 2015 at 5:53

2 Answers 2

5

Usually you can only determine the assembly language for the object file, using a disassembler. Here are a few links to discussion on that topic, e.g., for objdump:

Reverse-compiling (decompiling) is much harder. Here are a few links to help:

Sign up to request clarification or add additional context in comments.

3 Comments

Ok great thank you! Ill have a look
-1: Link-only answers are not seen as good answers on this side. Answers should be able to stand up on their own without any links which your answer does not.
The what's a good C decompiler question is deleted >:(
-1

.o file has object code and cannot be converted back to its original .c file having high level code . It is just like the fact that chewed food cannot be converted back to its solid form.

1 Comment

Bad analogy. It's more like IKEA furniture. With a full understanding of the assembly language (manual), compiled code can be manually rebuilt to perform the same task. It is quite difficult work, and it won't be the exact C code (since compilers do lots of optimizing) but it will be functionally equivalent.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.