Make 32 and 64 bit executable?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuesta aceptada
Image Analyst
el 11 de Jul. de 2012
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 comentarios
Image Analyst
el 11 de Jul. de 2012
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).
Más respuestas (1)
hana
el 11 de Jul. de 2012
you have to compile the 32bit executable on a 32bit machine and the 64bit one on a 64.
2 comentarios
Walter Roberson
el 14 de Jul. de 2012
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.
Ver también
Categorías
Más información sobre C Shared Library Integration en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!