I m not sure if this is even possible, but given an executable file (foo.exe), with has many libraries which has been linked statically.
Is there any software that extract from this file the .lib ( or .a ) that lay inside the executable ?
Thanks.
I m not sure if this is even possible, but given an executable file (foo.exe), with has many libraries which has been linked statically.
Is there any software that extract from this file the .lib ( or .a ) that lay inside the executable ?
Thanks.
Incredibly unlikely since, typically, you don t get the entire contents of the library injected into your executable.
You only get enough to satisfy all the undefined symbols. This may actually only be a small part of the library. A library generally consists of a set of object files of which only those that are required are linked into your executable.
For example, if the only thing you called in the C runtime library was exit()
, you would be very unlikely to have the printf()
family of functions in your executable.
If you linked with the object files directly, you may have a chance, since they would be included whether used or not (unless your linker is a smart one).
But even that would be a Herculean task as there may be no information in the executable as to what code sections came from specific object files. It s potentially doable but, if there s another way, I d be looking at that first.
Let me clarify the typical process:
a.o
, b.o
, c.o
and d.o
contain the functions a()
, b()
, c()
and d()
respectively. They are all added to the abcd.a
archive.b()
calls c()
.a()
and b()
and you compile it then link it with the abcd.a
library.a.o
and b.o
out of the library and into your executable, satisfying the need for a()
and b()
but introducing a need for c()
, because b()
needs it.c.o
out of the library and into your executable, satisfying the need for c()
. Now all undefined symbols are satisfied, the executable is done and dusted, you can run it when ready.At no stage in that process was d.o
dragged into your executable so you have zero hope of getting it out.
Update: Re the "if there s another way, I d be looking at that first" comment I made above, you have just stated in a comment to one of the other answers that you have the source code that made the libraries you want extracted. I need to ask: why can you not rebuild the libraries with that source? That seems to me a much easier solution than trying to recreate the libraries from a morass of executable code.
Imagine having 10 books in language you don t understand, without covers, title pages, page numbers and chapters. Some of the books can be incomplete. All pages are shuffled together so it is impossible to find out where is the beginning and end of each book.(each page is a function call) Now try to find page 123 of book 5 (let s say it is mentioned above function Exit()).
Well, IT IS possible...
It seems like you re asking for a decompiler. Such tools are difficult to use (probably impossible for mildly sophisticated C++) and if there is any other way of solving your problem, including taking a couple months to rewrite the libraries, I d recommend that course of action.
Like pax pointed out, even if you did use a decompiler, you would only get the library functions that the executable called.
I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...
I have been searching for sample code creating iterator for my own container, but I haven t really found a good example. I know this been asked before (Creating my own Iterators) but didn t see any ...
Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...
I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?
Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...
Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...
I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...
Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?