opening a dll file with matlab

28 views (last 30 days)
kay Dee
kay Dee on 7 Mar 2020
Commented: Walter Roberson on 7 Mar 2020
Hello Everyone
I have a dll file named (fape.dll) that contains some matlab codes and i would like to open it , can you please tell me how to open that file , in order to view codes that are inside .
Thank you very much .

Answers (1)

Walter Roberson
Walter Roberson on 7 Mar 2020
dll files are compiled into machine code. They do not have any remaining MATLAB code.
In some ways of generating a dll from MATLAB code the MATLAB code is kept as comments in C or C++ source code. You would have to open the C or C++ source code to see it. C and C++ compilers do not store a copy of the code inside of a dll
  2 Comments
Walter Roberson
Walter Roberson on 7 Mar 2020
but does it mean i need to find the C or C++ source code
Yes.
However, when the DLL was built, unless the compiler was told to strip the symbol table, then typically it would take a record of the name of each file that was used for each code location. Then, typically if you were to open the DLL in an Integrated Development Environment (IDE), and were to step through the code, then at each step the IDE would open the source code and move to the line of (C or C++) source; if you are lucky then you asked to have the MATLAB code recorded in the comments of that source.
However, this ability to automatically navigate to the appropriate source file requires that the source file is available to you: if all you have is a copy of the DLL, then you would not have that code.
Also, MATLAB can generate two different kinds of DLL from MATLAB code. One of the kinds of DLL construction compiles MATLAB code into threaded interpreted data structures that are evaluated by a copy of the MATLAB Execution Engine, very like executing inside MATLAB. There is no known way to access the code after this is done (except to happen to have a copy of the source code.) The second kind of DLL construction compiles MATLAB code to C or C++, that can then be compiled. This is the variety that just might permit you to read the original MATLAB code out of the comments of the C/C++ source.
Neither kind of DLL executes MATLAB code directly, only code that has been processed into a different form.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!