Clear Filters
Clear Filters

matlab compiler vs mcc functionality

28 views (last 30 days)
CM
CM on 20 Mar 2024
Edited: CM on 30 Apr 2024
Hi, I am testing out the matlab compiler and the mcc function. I cannot get a full overlap of functionality between them. For example:
When using the mcc function, is there a way to include matlab runtime in the package, and specify the name of the installer executable? That is, the equivalent of the check box and edit field at the top of the compiler.
When using matlab compiler, is there a way to specify conversion of m files to p code (the '-p' option)?
Also, how do I validate that my compiled executable is using p code rather than m files?
I noticed some behaviour with matlab compiler regarding precedence that I think is contrary to the documentation. If the m files are in the same folder as the main file, then the m files take precedence over p code files, otherwise p code files take precedence. I suspect it is not matlab's intention that you create the p code files separately prior to compiling the executable, as I could not get this to work using mcc or compiler. I can only get it to work using mcc on m files with the '-p' option on. Some better examples or guidance would help here, as I am testing out lots of different ways to do things in the hope of finding what works.
Apologies if this is too many questions in one post.

Answers (1)

Dirk Engel
Dirk Engel on 27 Apr 2024
I assume that by "MATLAB Compiler" you are referring to the MATLAB Compiler user interface (deplytool) which you can use to build and package your app. mcc only covers the build step, not the packaging. That's why there is no full overlap between the two.
Use the -o option of mcc to specify the name of the final executable.
Note that the compiled application contains encrypted files with the .m extension, but these are no normal m-files. They are neither human-readable, nor can they be be decrypted (to the best of my knowledge), nor can they be taken from the compiled app and used in a different context such as in MATLAB or in another compiled app. The files are encrypted with a key that changes with each compilation, so they only work in the context of that one specific compiled app. There is no need to create p-code before compilation. Your intellectual property is well protected in a compiled app.
  5 Comments
CM
CM on 30 Apr 2024
Edited: CM on 30 Apr 2024
Thanks Walter. I intend to use the p code option in creating my executables. I understand that in addition to being another layer of protection, if they do crack it, they end up with code that has no comments (and obscured variable names?), so it would be difficult to do any further improvements to it, so it would be no better than a hacked executable with the licencing provisions bypassed. Or at least, it would probably be just as easy to re-write it from scratch.
CM
CM on 30 Apr 2024
"It is not created specifically for your app but can be re-used by multiple apps."
Thanks Dirk. Regarding downloading MCR from the matlab website, I would like to have the package appear to be completely self contained and branded. I don't think the GB's of download will be an issue.

Sign in to comment.

Categories

Find more on C Shared Library Integration in Help Center and File Exchange

Products


Release

R2023a

Community Treasure Hunt

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

Start Hunting!