How does MATLAB app designer call external. m functions after packaging into exe?

75 visualizaciones (últimos 30 días)
shen hedong
shen hedong el 30 de Dic. de 2024 a las 2:24
Comentada: shen hedong el 31 de Dic. de 2024 a las 1:17
How does MATLAB app designer call external. m functions after packaging into exe? Please note that this external function is not packaged into EXE. Who can help me! I have tried commands such as' addpath ',' filread ',' eval ', but after testing, none of them worked.
  3 comentarios
Steven Lord
Steven Lord el 30 de Dic. de 2024 a las 19:54
The matlab.lang.obfuscateNames function introduced in release R2024b may be of interest.
shen hedong
shen hedong el 31 de Dic. de 2024 a las 1:17
Thank you very much, your minify function is really amazing! Thank you for your contribution!

Iniciar sesión para comentar.

Respuestas (2)

Manikanta Aditya
Manikanta Aditya el 30 de Dic. de 2024 a las 4:05
Editada: Manikanta Aditya el 30 de Dic. de 2024 a las 4:06
When you package a MATLAB App Designer app into an executable (EXE), calling external .m functions that are not included in the EXE can be tricky.
Here are some steps and considerations to help you achieve this:
  1. Include External Functions in the Package: Ideally, you should include all necessary .m files in the packaging process. This ensures that all dependencies are available when the EXE runs.
Refer to the following MATLAB Answers posts to know more about the query:
I hope this helps you.
  3 comentarios
Manikanta Aditya
Manikanta Aditya el 30 de Dic. de 2024 a las 6:30
To strongly encrypt your .m files and protect your MATLAB code from being cracked, while you mentioned that pcode can be cracked, it is still a useful first step. pcode obfuscates your code, making it harder to read and modify.
  • Use the MATLAB Compiler to compile your .m files into standalone executables or shared libraries. This approach converts your MATLAB code into a binary format, which is much harder to reverse-engineer compared to pcode.
  • In addition to pcode, you can manually obfuscate your code by renaming variables and functions to non-descriptive names, removing comments, and using complex logic structures. This makes it more difficult for someone to understand and reverse-engineer your code.

Iniciar sesión para comentar.


Walter Roberson
Walter Roberson el 30 de Dic. de 2024 a las 5:55
Editada: Walter Roberson el 30 de Dic. de 2024 a las 6:00

When you package into exe then external .m that are not packaged as part of the exe, cause an error when they are called.

Only .m and .mlx and .p and .mdl and .slx (and possibly a few others) that are packaged with the exe can be called. It is impossible for external .m not bundled with the exe to be called. All .m must have been pre-parsed and encoded into ctf format to be callable.

The purpose of compiling into exe is to create a limited-functionality executable. If it were possible to run external .m that were not compiled into the bundle then unlimited functionality could be built. Imagine an executable that simply called an external .m and returned, then the user could supply arbitrary code in the .m and thus evade the need for a matlab license to execute arbitrary code. Therefore it will never be possible to execute external .m that are not bundled into the exe

  1 comentario
shen hedong
shen hedong el 30 de Dic. de 2024 a las 6:24
Thank you very much for your answer. Actually, I can currently solve this problem by packaging it in app format instead of exe format. In order to protect my code, I encrypted the app format code using the pcode command. However, there are many ways to crack p files on the internet now, so do you have a way to strongly encrypt. m files? I don't want my code to be cracked by others.

Iniciar sesión para comentar.

Categorías

Más información sobre Programming Utilities en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by