MEX files do not work on a network drive on Windows
I am trying to develop MEX files using the IDE within Microsoft Visual Studio 2022. I am using the templates provided by https://marketplace.visualstudio.com/items?itemName=gharveymn.MEXFunctionTemplates. I am starting with a simple MEX file – I have tried "C:Program FilesMATLABR2024aexternexamplescpp_mexarrayProduct.cpp" and "C:Program FilesMATLABR2024aexternexamplesmexarrayProduct.c". I successfully build the .mexw64 file and copy it to an empty directory on my C drive. The MEX file works as expected.
However, if instead I copy the .mexw64 file to a network directory and then add that directory to the Matlab path, the MEX file does not work. Matlab seemingly hangs along with the rest of Windows. My only path to recovery is a hard reset via the power button. I have tried mapping the network directory to a drive letter to no avail.
Any suggestions for a fix would be greatly appreciated. I realize I could build these simple MEX files with the mex command in Matlab, but my goal is to next build a MEX file that calls other libraries. Developing within Visual Studio has worked well for me in the past (pre-2017). The ability to provide additional include directories, additional library directories, additional library filenames, etc. within the IDE is valuable. I also have previously been able to perform debugging within VS as well. But right now I can’t get even these very basic MEX files to compile without adding the additional stuff in.
Thanks!I am trying to develop MEX files using the IDE within Microsoft Visual Studio 2022. I am using the templates provided by https://marketplace.visualstudio.com/items?itemName=gharveymn.MEXFunctionTemplates. I am starting with a simple MEX file – I have tried "C:Program FilesMATLABR2024aexternexamplescpp_mexarrayProduct.cpp" and "C:Program FilesMATLABR2024aexternexamplesmexarrayProduct.c". I successfully build the .mexw64 file and copy it to an empty directory on my C drive. The MEX file works as expected.
However, if instead I copy the .mexw64 file to a network directory and then add that directory to the Matlab path, the MEX file does not work. Matlab seemingly hangs along with the rest of Windows. My only path to recovery is a hard reset via the power button. I have tried mapping the network directory to a drive letter to no avail.
Any suggestions for a fix would be greatly appreciated. I realize I could build these simple MEX files with the mex command in Matlab, but my goal is to next build a MEX file that calls other libraries. Developing within Visual Studio has worked well for me in the past (pre-2017). The ability to provide additional include directories, additional library directories, additional library filenames, etc. within the IDE is valuable. I also have previously been able to perform debugging within VS as well. But right now I can’t get even these very basic MEX files to compile without adding the additional stuff in.
Thanks! I am trying to develop MEX files using the IDE within Microsoft Visual Studio 2022. I am using the templates provided by https://marketplace.visualstudio.com/items?itemName=gharveymn.MEXFunctionTemplates. I am starting with a simple MEX file – I have tried "C:Program FilesMATLABR2024aexternexamplescpp_mexarrayProduct.cpp" and "C:Program FilesMATLABR2024aexternexamplesmexarrayProduct.c". I successfully build the .mexw64 file and copy it to an empty directory on my C drive. The MEX file works as expected.
However, if instead I copy the .mexw64 file to a network directory and then add that directory to the Matlab path, the MEX file does not work. Matlab seemingly hangs along with the rest of Windows. My only path to recovery is a hard reset via the power button. I have tried mapping the network directory to a drive letter to no avail.
Any suggestions for a fix would be greatly appreciated. I realize I could build these simple MEX files with the mex command in Matlab, but my goal is to next build a MEX file that calls other libraries. Developing within Visual Studio has worked well for me in the past (pre-2017). The ability to provide additional include directories, additional library directories, additional library filenames, etc. within the IDE is valuable. I also have previously been able to perform debugging within VS as well. But right now I can’t get even these very basic MEX files to compile without adding the additional stuff in.
Thanks! mex, visual studio MATLAB Answers — New Questions