7
votes

I have compiled some matlab functions using Matlab R2012a into .net DLL files. and everything is working as it should. i am using WPF/C# .net 4.5 on windows 7 64bit and my program works ok.

however we are now transferring and testing our program on windows 8 pro. we have a problem in runtime - we are using of course MCR R2012a in order to run the .dll files. we can't load the classes or functions in win8 and our program crashes.

have anyone came across this problem? will it help if we will compile the functions using Matlab R2013a?

2
It would be helpful to know some of the behavior when the program crashes. Any leads such as distinctive errors, a specific exit code, anything in the event log, etc.?SeanKilleen
Yes. There’s an error: Managed (v4.0.30319)' has exited with code -1073741819 (0xc0000005) 'Access violation'.Gilad
Given the nature of the error, have you made sure that the account running it has full access rights to any of the folders that the application would use? I would also see if right-clicking the program and choosing "Run as Administrator" helps. It may be that on Win8, seeking to do something in that context trips a slightly more sensitive UAC system. Please confirm whether you've tried those things.SeanKilleen

2 Answers

10
votes

The solution to the matlab problem with windows 8 is to add

[assembly: MathWorks.MATLAB.NET.Utility.MWMCROption("-nojit")]

in the assembly file.

I do not know why this works. nojit- means no just in time compiler which creates binary file.

however when I have added this. it worked on windows 8 x64 as well. with the same MCR

0
votes

Most of the problems I had with MCR had to do with wrong value of the PATH variable. This can happen when you install more than one MCR on a computer, or sometimes even when you install just one. Since you get an access violation error, i guess that the system can find the MCR dlls, but it finds the wrong ones (for example 32 bit instead of 64 bit). Check carefully your PATH environment var and make sure it points to the correct location of MCR dlls.