views:

109

answers:

3

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?

A: 

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?

Andrew Janke
Yeah I'm sure he has the 64-bit version. We are going through the Dlls using dependency walker right now. Thanks!
Shaihi
A: 

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

Jonas
I did not use a debug flag when compiling so I am pretty sure it is in release mode.
Shaihi
A: 

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

Shaihi