How can I include a version resource file in a MEX function on Windows?

5 views (last 30 days)
I am using MATLAB on Windows and am creating a MEX-file. Since a MEX-file is a shared library, I would like to be able to include version information in the MEX-file in the same way that I do with other DLLs, that is using a resource file.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 2 Nov 2020
Edited: MathWorks Support Team on 2 Nov 2020
It is possible to add a version resource to a MEX-file. Below are the general steps.
1) Create a compiled version resource file (.res). This can be done using Microsoft Visual Studio's resource compiler (RC) which will compile a resource script (.rc). One easy way to do this is to create a version resource file in a dummy win32 shared library project.
If you need help creating a compiled version resource please refer to the Microsoft Visual Studio documentation at
2) Compile the MEX file and include the resource file created in step 1. For example, if you have a compiled resource file version.res the following command will link it to the MEX-file.
mex yprime.c version.res
Note that you need to use the compiled resource file in order to link it to a MEX-file.

More Answers (0)

Categories

Find more on Write C Functions Callable from MATLAB (MEX Files) in Help Center and File Exchange

Tags

No tags entered yet.

Products

Community Treasure Hunt

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

Start Hunting!