stand-alone exe's decompose into temp .m's?
Show older comments
Hi-
I have used the Deploy tool to compile a stand-alone exe, but I see that when run, the exe somehow decomposes itself into some constituent .m files in a secret temp folder. This is leading to nstable, unpredictable behavior. I don't know if the temp .m files are depending now on the local DOC command window PATH variable to search for other functions and not finding them... or just that I launch ~64 instances of the exe that are perhaps all sharing that temp folder? Whatever it is, it doesn't work well.
How does all that work... and how do I get a more truly "stand-alone" exe that needs nothing... w/o blowing up the exe size?
Problem has persisted for months :(
Answers (1)
Walter Roberson
on 19 Nov 2018
0 votes
"and how do I get a more truly "stand-alone" exe that needs nothing... w/o blowing up the exe size?"
You would use MATLAB Coder to create the executable. MATLAB Compiler always has the behavior you note.
6 Comments
David Pesetsky
on 19 Nov 2018
Walter Roberson
on 19 Nov 2018
It is a separate (and expensive ) product that can be used to compile a subset of Matlab into C or C++ code which you can then build into an executable .
What you described about compiled executables blowing up into a temporary directory is inherent technology for matlab compiler. The compiler tool effectively builds an encrypted zip file (equivalent ) of the source code and at run time unzips the directory structure (but leaving it encrypted ) and uses the regular matlab execution engine on it . This cannot be escaped with the compiler product so if it is not acceptable then you need to stop using the compiler product .
David Pesetsky
on 19 Nov 2018
Walter Roberson
on 19 Nov 2018
You cannot compile MCR as it is not source code. Perhaps there would be a way to statistically link it in so that it did not have to be installed, but doing so would not change the fundamental technology of how the code was executed .
You should understand that matlab is an interpreter that has some efficiency techniques inside it such as run time transformation of fragments into machine code. But at one fundamental level matlab code is "data" that is processed by the execution engine . The matlab compiler product retains exactly the same setup just with encrypted data . It must break everything up into separate files because it is executing the same way that regular matlab is . The exe unzips the structure and runs the execution engine .
matlab coder is fundamentally different , producing C or c++ code that can be truly compiled .
David Pesetsky
on 19 Nov 2018
Categories
Find more on MATLAB Compiler 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!