Building portable MEX files
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi. My question is how to build MEX files that are portable using the Matlab Coder?
The problem: I can build a MEX file, using Visual Studio C++ Express from auto generated (by Matlab Coder) C code that can run on my system with no problems, but when I try to run it on a different system, without Matlab Coder, I cannot run it even after installing the Visual Studio redistributeable files. The error code I get is: "Invalid MEX file: specific module cannot be found".
The by far optimal solution: I have actually looked deeper into this and found, using DependencyWalker, that a number of DLL files are required in order for the MEX file to run. If they are not present in the system path, or working directory, the MEX file cannot run and gives the above error code.
Can anyone comment/aide on this?
Sincerely, Tobias Elmøe
0 commentaires
Réponse acceptée
Friedrich
le 12 Juil 2011
Hi,
you are getting this error because you compiled with a Visual Studio compiler and during compiling you will link against certain libraries from that Visual Studio. In order to be able to run that mex file on a different machine you have to install the matching redistributable version on the target machine. Matlab is shipped with the 2005 redistributable package. So please install the 2008 or 2010 redist. package on the target machine.
I think the only way to make a mex file portable is to use a 32bit ML and use the LCC for compiling. But this will limit you to use 32bit ML only.
2 commentaires
Plus de réponses (3)
Alexander Bottema
le 12 Juil 2011
Hi Tobias, Do you know what DLLs are missing? When you say that you try to run it on a different system, does this mean that MATLAB is installed (but not MATLAB Coder)? Or do you mean that MATLAB itself is not installed? Thanks, Alexander
Friedrich
le 12 Juil 2011
Hi,
please contact MW Technical Support for this. It seems that ML Coder is not made for deplyoing your mex functions to other ML users.
I think the Technical Support can tell you more about this.
(Simply copying the missing DLLs will violate the license agreement)
3 commentaires
Friedrich
le 12 Juil 2011
It really looks like that it is not made for deploying. The MCR provides these DLLs which your mex file is missing. So writing a wrapper function and compiling it into an exe should work fine. But I think there is no easy way to deploy the mex file only.
Contact the Support and mention these two internal numbers: g730952 and g613886 (this should speed things up)
Voir également
Catégories
En savoir plus sur MATLAB Coder dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!