MATLAB: How to obtain the manifest file for an generated mex file in MATLAB 7.11 (R2010b)

MATLAB

I am creating a mexw64 from my cpp file. During compilation I can see that there is created an *.manifest file, which gets deleted before the execution of the MEX command has ended.
Is there a possibility to keep this manifest file to be able to check the versions of the necessary system libraries. I need this information, because when deploying this file, users often receive error messages like
could not load *.mexw64 ...
because their Windows has other versions of the system libraries installed – especially different input/ouput libraries.

Best Answer

There are three possibilities to obtain this manifest information:
1. If you open the MEX-file in a text editor, you can see the manifest in pretty plain text (in between all kinds of binary code)
2. You can use the mt.exe tool from Microsoft to extract the manifest again
3. You can edit mexopts.bat and change the POSTLINK_CMDS2, which is the one which deletes the manifest. (The appropriate mexopts.bat can be found in your preference directory, which you can get by the PREFDIR command.)
If you look at mexopts.bat
a. The compiler generates the manifest
b. In POSTLINK_CMDS1 the manifest is embedded in the MEX-file
c. In POSTLINK_CMDS2 the external manifest is deleted as it is no longer needed