getting c code from an existing mexw64 file
30 views (last 30 days)
Show older comments
Answers (3)
Jan
on 25 Aug 2011
The most efficient method to get the C-source is asking the author. If he or she hesitates to share the source code, offering a service in return helps usually, e.g. money.
This is not a joke. Sometimes such trivial solutions are overlooked. Extrem experts in programing are sometimes less advanced in interpersonal communication.
0 Comments
Walter Roberson
on 24 Aug 2011
There are "decompilers" available on the 'net .
Don't bother searching for anything specific to decompiling mexw64 (IMHO) -- the files are object libraries in your operating system's standard format.
Note that any C code that you get back will not be the original source code -- just code that compiles to the same thing. No comments, variable names will differ, internal routines may have different names, the code order might differ a fair bit, and so on.
0 Comments
Desiree
on 25 Aug 2011
What you are asking for is known as reverse engineering of compiled files. While this is not impossible to do it takes a lot of effort, time and resources to completely reverse engineer a mex file. So this is not impossible but you could think in the dimensions of 20 CIA agents working on this for a year or so to accomplish this. So not really worth the effort. There are decompilers for DLLs (not sure about MEX files though) but there are certain limitations involved when using them (as Walter Roberson mentioned).
2 Comments
Jan
on 25 Aug 2011
@Desiree: MEX files are standard DLLs. I agree that usually a complete decompilation needs more resources that re-writing the C-function from scratch. But if you look for a certain detail only, a fast success is possible - e.g. to find a CPU-ID check, which restricts the usage of SSE-features.
In addition a reverse-engineering is very often forbidden by the license conditions. So read them carefully before you start.
I do not have the impression, that CIA-man-year is a reliable unit to measure complexity. As far as I remember, CIA agents are faster in finding mass-destruction weapons than the enemy in producing them. (Sorry for this term! I know, that these weapons do not destruct _mass_.)
Desiree
on 25 Aug 2011
CIA-man-year was just an example to illustrate the amount of effort that may be needed for complete decompilation. I understand what you mean though...
See Also
Categories
Find more on String Parsing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!