matlab Compiler using mex file

14 ビュー (過去 30 日間)
Marc
Marc 2018 年 9 月 19 日
コメント済み: Royi Avital 2020 年 4 月 28 日
Hi
I have created a application with a GUI and compile it with matlab Compiler. This application uses a mex file to execute some functions. This mex file uses some dll. I have put the mex file and all the dll in the same directory as the compile application. When I activate the functionality that use the mex file, nothing append. The application never crash but the application do nothing. Is it the right way to use mex with a compiled application.
Thank you

回答 (8 件)

Siddharth Bhutiya
Siddharth Bhutiya 2018 年 9 月 21 日
If the application uses MEX, DLL or shared libraries, the dependency analyzer will not be able to detect it so you will have to add them as well as other dependencies that they might have, while compiling your application. Please refer to the link below for more details.

Marc
Marc 2018 年 9 月 21 日
Thank you for you answer. I will look at your suggestion closely. I have tried to add manually the dll in the installed folder without success but I'm not sure I put it in the right folder. Do you have information in witch directory, (Application, AppData etc) I need to put the dll?
  2 件のコメント
Siddharth Bhutiya
Siddharth Bhutiya 2018 年 9 月 21 日
If you are compiling your MATLAB Application using mcc command you will have to use the -a option to add files and if you are using the GUI based MATLAB Compiler you can add them using the button with a plus sign under "Files required for your application to run". You can find more information about "mcc" command and other options in the documentation link below
Royi Avital
Royi Avital 2020 年 4 月 28 日
Can I add a whole folder? Will it be added to "path" on deployment?
What Im after is what's the folder structure model for compiled applications.
Is it a single folder with all files?

サインインしてコメントする。


Marc
Marc 2018 年 9 月 24 日
Hi,
I have followed your advice and I have some improvements. Now all my dll files and mex files are installed in the right folder at the moment of the installation. By the same time I have also realized that is possible to keep the windows command line window open and get error message. The issue I have is exactly what I was thinking. The mex file is not found. What I do not understand is the application is looking for this mex file in a folder located in c:\users\[myuser]\appdata\local\temp\mcrcache9.1\...\... (really long path) why it is looking for the mex file in this path instead around the application and where the installer put it?
  1 件のコメント
Bruno Luong
Bruno Luong 2018 年 9 月 24 日
The compiler generates a standalone application that can run on any PC, even that that does not have MATLAB installed. It make a self-contained package with anything it needs together and does not call any function outside the package.

サインインしてコメントする。


Marc
Marc 2018 年 9 月 24 日
Yes I understand that this is the principle of using Matlab Compiler. Instead of that, I receive an error message that the package is looking for the mex file. The question is why it looking for this file outside of the application folder.
  1 件のコメント
Walter Roberson
Walter Roberson 2018 年 9 月 24 日
The exe produced and stored in the application folder efficiently unzips itself into a temporary directory that is not under the application folder. Think of the part that you install as being a self extracting archive.

サインインしてコメントする。


Bruno Luong
Bruno Luong 2018 年 9 月 24 日
The packaging is put on CTF file or directly in EXE file then unpack the first time you run at the location where it think it's suitable, not necessary on your app folder.

Marc
Marc 2018 年 9 月 25 日
I have follow the path given in the error message. As you explain, the code is just unpack in a location in the AppData directory. My concern is that my mex file is present in this folder. By reading again the error message I see that the problem is not because the mex file is not found but it is in valid: (my error : Invalid MEX-file ). I get this error also when I install my application on the same computer I have develop the application.
  1 件のコメント
Bruno Luong
Bruno Luong 2018 年 9 月 25 日
How do you build the mex and the DLL?

サインインしてコメントする。


Marc
Marc 2018 年 9 月 25 日
The Dll are dlls from an external library. I build the mex in matlab using mex function. The compiler I'm using is VisualStudio 2015. This mex is working great when I use it directly in the Matlab environment.
  1 件のコメント
Bruno Luong
Bruno Luong 2018 年 9 月 25 日
Do you install the 2015 redistributable on the target computer?

サインインしてコメントする。


Marc
Marc 2018 年 9 月 25 日
Not specifically but I got the same error message on the machine where VS2015 is installed (my development machine)

カテゴリ

Help Center および File ExchangeC Shared Library Integration についてさらに検索

製品


リリース

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by