getting c code from an existing mexw64 file

32 views (last 30 days)
Christian
Christian on 24 Aug 2011
is there a way?

Answers (3)

Jan
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.

Walter Roberson
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.

Desiree
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
Desiree
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...

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!