문제

I have a mex64 dll compiled on my machine. I used Matlab 2009b with VS2008 Pro to compile the dll. The dll works fine on my Matlab installation.

I want a colleague to use the dll so I sent it to him and he gets the following error message when trying to use the dll:

??? Invalid MEX-file 'filename.mexw64': The specified module could not be found.

My current assumption is that this is caused because he uses an older Matlab version or missing a dll that I have. I ran dependency checker and asked him to check that he has all the listed dlls.

I am still waiting for him to confirm his Matlab version.

What other reasons can cause this and can the Matlab version make a difference? (I mean R2009a when I have R2009B and not a huge version diff)


The other person has Matlab R2009a. Shouldn't the mex just work if I compile it on my computer and deliver it to him?

Does this only leave a missing dependent dll?

도움이 되었습니까?

해결책 4

The Dll was a wrapper for MySql access. We ended up using Matlab's ODBC and the MySql Connector.

다른 팁

The issue is strange, but I can confirm it exists.

Using pre-built libraries for matlab that are correctly installed and in the path, I sometimes get the same error. If I type in the function name at the command-line, the function is visible and will auto-complete. However, the function will not initialize until I 'cd' into the directory with the .mexw64 library file.

>> AndorInitialize('')
Invalid MEX-file 'C:\Program
Files\MATLAB\R2011b\toolbox\andor\AndorInitialize.mexw64': The
specified module could not be found.

>> path

        MATLABPATH

    C:\Program Files\MATLAB\R2011b\toolbox\andor
    C:\Program Files\MATLAB\R2011b\toolbox\andor\camera files
    C:\Program Files\MATLAB\R2011b\toolbox\andor\m files
    ... etc

It turns out this is due to missing dependencies, which shouldn't be missing. To resolve the issue, use dependency walker (free, lightweight) to identify what's missing. The mathworks explains this.

http://www.mathworks.com/support/solutions/en/data/1-2RQL4L/

In my case, two DLL's weren't showing up properly, even though they were on my system and in the path. I copied the DLL's into the windows/system32 folder and the library functions now work correctly. What's particularly strange is that the same library worked on my computer a few days ago (prior to the moving the DLL's).

In general, MEX files should work across different versions of Matlab; in particular, they should be forward-compatible. You're right; sounds like a dll problem.

If you built it with Visual Studio, it may be linked to the Visual C++ Runtime. This is a set of libraries that is not installed on Windows by default. The "redistributable" for it can be downloaded here; having your coworker install that could resolve the problem. If that doesn't work, you can use Dependency Walker to check for other unsatisfied DLL dependencies.

Normally, configuring Matlab's "mex -setup" to use the Lcc compiler that's distributed with Matlab could be a way around this, but it's not supported for 64-bit Windows AFAIK.

Also, are you sure he has the 64-bit version of Windows?

Another possible source of the problem could be that you compiled in debug mode. The Visual C++ redistributables only support release mode.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top