Make 32 and 64 bit executable?
1 回表示 (過去 30 日間)
古いコメントを表示
Hello!
I have a script that makes an executable for an application. We used to just create a 64bit executable, but now we want a 32bit executable as well. I installed the 32bit MATLAB, but now whenever I create the 64bit executable it crashes right after starting (Windows', "x.exe has stopped working" error).
I have tried changing the compiler, but it has not had an effect.
How can I fix this?
Thanks!
0 件のコメント
採用された回答
Image Analyst
2012 年 7 月 11 日
What crashes: MATLAB while compiling, or your application while running on the target computer? You need to be running the 32 bit version of MATLAB when you compile an executable for a 32 bit computer, and you need to be running the 64 bit version of MATLAB when you compile an executable for a 64 bit computer. You can do both of these on your 64 bit computer - you don't need a 32 bit computer. But you do need to re-run "mbuild - setup" (or so I've been told) whenever you switch from compiling on one version to compiling on the other version.
5 件のコメント
Image Analyst
2012 年 7 月 11 日
I might be able to see that happening on a 32 bit machine. The executable is not really the executable but rather a self extracting archive that unpacks the real executable and a bunch of other stuff to a hidden folder in your c:\users\Daniel\.... folder. And that is the one that actually gets run. If you run it again, I think it doesn't need to unpack the stuff and just goes right there to run it immediately. However if you tried to run your 64 on a 32 machine, and then it failed, and then tried to run the 32 bit executable, it might see that hidden stuff if unpacked and decide it doesn't need to do it anymore. Unfortunately it would then be running the 64 bit version which failed, rather than unpacking a new 32 bit version. So it would crash again. Put this line in your code to see where it actually is running:
fprintf('MATLAB is actually running from %s\n', ctfroot);
Since you paid a ton of money for the compiler, I suggest you ask the Mathworks for all the details. You can change where it unpacks all the stuff by changing the MCR_CACHE_ROOT environment variable to dot if you don't want all this stuff buried in some secret hidden folder. (Ask them how).
その他の回答 (1 件)
hana
2012 年 7 月 11 日
you have to compile the 32bit executable on a 32bit machine and the 64bit one on a 64.
2 件のコメント
Walter Roberson
2012 年 7 月 14 日
Image Analyst is correct: compiling for 32 bit machines on a 64 bit machine has been officially supported for a couple of releases, and technical solutions were made public for how to do it for a couple of releases before that.
参考
カテゴリ
Help Center および File Exchange で C Shared Library Integration についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!