2

I'm a bit of a beginner to C# and I've recently built a Windows Form Application GUI which executes a MATLAB function in much the same way as the answer presented here. So essentially using the Process.Start method to run the MATLAB function in the background.

This works fine with a 32-bit compiled MATLAB function, however compiling the function as a 64-bit executable leads to an error when executing from the WFA GUI - "Could not find version 8.2 of the MCR. Attempting to load mclmcrrt8_2.dll."

If I run the compiled function outside of the WFA GUI I have no problems. So it seems that the WFA cannot execute 64-bit processes, is there a workaround for this?

Thanks for any help.

Community
  • 1
  • 1
  • _So it seems that the WFA cannot execute 64-bit processes_ No, you can run whatever you want (32 bit from 64 bit or 64 bit from 32 bit) so problem is somewhere else (dependencies? **working directory**?) – Adriano Repetti Nov 04 '13 at 11:42
  • I've tried un-installing the 32-bit MCR and moving the 64-bit MCR between the "Program Files" and "Program Files (x86)" folders all to no avail. I was under the impression though that executing a process using the Process.Start method was virtually the same as running the process independently of the GUI, so it doesn't make sense that the function is able to run when executed by itself but fails to find the MCR when executed from within the WFA? With respect to any dependencies, I have not defined any for the 32-bit function which works fine... – user2848074 Nov 04 '13 at 12:02
  • Bit of a weird one this one but it seems the problem has resolved itself in the background somehow. I came across a similar issue again on a different machine when I tried running a 64-bit Matlab compiled application (built using Matlab alone, i.e. no C# WFA) and it failed to see the MCR again even though this was installed in the Program Files folder. However it may be important to note that an installation of Matlab itself was uninstalled prior to testing the app. Installing the MCR again in the Program Files (x86) resulted in the app working. – user2848074 Nov 20 '13 at 11:59

1 Answers1

1

You cannot have both MATLAB and MCR installed on the same machine and consistently run at deployed app.

I have not had any luck if both x32 and x64 MCR are installed, but you can have different version of the MCR installed, although that's not optimum.

If you have an x64 MCR deployed MATLAB, you must use x64 in your c# app.

This is not clearly documented, and these are from my experience deployed the same MATLAB base as a COM DLL, an x32 .NET assembly, and an x64 C++ shared library.

Kate
  • 283
  • 2
  • 11