ENVIRONMENT : epics 7.0 - MatlabR2022 - Windows 10 Pro
It would be preferred that those program were installed in a path without blank spaces. Maybe is not necessary, but I did so.
Once downloaded the library, edit the ./configure/RELEASE file
Change the EPICS_BASE value with the installation path of your EPICS, at the base level
I also set EPICS_HOST_ARCH=windows-x64
But this could be not necessary.
Uncomment and set the MATLABDIR variable with the path of you matlab installation
The MAKEFOR variable in CONFIG is MATLAB as DEFAULT so there's no need to change it
Uncomment and change the value of MATLIB_SUBDIR with the RELATIVE path between your ${MATLABDIR}/lib and the directory where is located the library 'libmex.lib'
Use the / into the PATH just like in a LINUX PATH:
c:/mypath/mysubpath
BUILDING THE LIBRARY
As building environment I used:
Microsoft Visual Studio Community Edition 2022
You have to install a make tool, because is not already present in Windows.
For this purpose I used Gnu Make 4.3 installed by Chocolatey
Now, Visual Studio 2022 and Make are not so pretty integrated, for this reason you could have some bad behaviour using the make from the IDE depending on the host architecture of the EPICS library that you have installed.
It could happens (and happened to me) that you have the 64 bit library from EPICS, but your Visual Studio will continue to use a 32 bit cl compiler for building your library even if you try to define the compilation target inside the IDE. This will brought you to fail your build.
So instead of Launching the Visual studio IDE, launch the:
X64 Native Tools Command Prompt For VS 2022 if you're compiling a 64-bit library or
X86 Native Tools Command Prompt For VS 2022 if you're compliling a 32-bit library
You will find both of those tools in Start → Visual Studio 2022 folder in the start menu.
Before you launch the build inside this command prompt, you have to change another point of the code:
Open the glue/mglue.h file and edit the line 91 that was
void lcaMexGblInit();
trasforming it in:
epicsShareFunc void epicsShareAPI lcaMexGblInit();
This is necessary because Windows for default doesn't export functions into library. It must be explicitly declared, differently from Linux.
Now, launching a MAKE command in the Prompt for VS,the command should run correctly and creating a subfolder of the matlab library folder, in which you will have all the .mexw64 that you need to put into your matlab.
You will need also the dll created in the folders ezca (ezcamt.dll) and in the folders glue (mezcaglue.dll)
That was our experience. Hoping could be useful for somebody
Alessandro