Is there a way to convert MEX file into original C++ code

조회 수: 20 (최근 30일)
Raj Sekhar Sana
Raj Sekhar Sana 2017년 11월 8일
댓글: Walter Roberson 2018년 12월 26일
I have Mex File i want to convert it into c++ code to change some functionality in the code, is there a way that i can achieve this? Thank you.
  댓글 수: 4
samatha solupati
samatha solupati 2018년 12월 26일
I have mex source file how to convert into c?
Walter Roberson
Walter Roberson 2018년 12월 26일
mex sources have three supported variety:
  1. mex source that is already C source and so no conversion is needed
  2. mex source that is C++ source . Converting C++ to C is not always possible because C does not have any exception handling . Otherwise if you look at early C++ compilers they compiled to C code... but that would have been for old versions of C++. For new enough C++ mex source you would have to do some rewriting into older versions before you could use a C++ to C translator
  3. mex source that is Fortran . there are Fortran to CC translator available .you would need to touch up the names of the interface functions .

댓글을 달려면 로그인하십시오.

채택된 답변

OCDER
OCDER 2017년 11월 8일
As discussed before in this Q&A link, it's VERY HARD to decompile a compiled mex code.
Going from .mex64 back to .cpp is not straightforward since all the information that makes code readable, such as variable names, are lost when compiling them. You would be better off asking for the source code or writing a mex function in c++ from scratch...
Here's another Q&A about reverse-engineering C++ code:

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Call C++ from MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by