跨计算机共享 mex64 文件

发布于 2024-08-28 21:32:26 字数 495 浏览 10 评论 0原文

我的机器上编译了一个 mex64 dll。我使用Matlab 2009b和VS2008 Pro来编译dll。该 dll 在我的 Matlab 安装上运行良好。

我想让一位同事使用该 dll,因此我将其发送给他,他在尝试使用该 dll 时收到以下错误消息:

???无效的 MEX 文件“filename.mexw64”:找不到指定的模块。

我目前的假设是,这是因为他使用了较旧的 Matlab 版本或缺少我拥有的 dll。我运行了依赖项检查器并要求他检查是否拥有列出的所有 dll。

我还在等他确认他的 Matlab 版本。

还有哪些其他原因会导致这种情况?Matlab 版本是否会有所不同? (我指的是 R2009a,当我有 R2009B 并且版本差异不大时)


另一个人有 Matlab R2009a。如果我在我的电脑上编译并交付给他,mex 不就可以工作了吗?

这是否只留下缺失的依赖dll?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

此岸叶落 2024-09-04 21:32:26

这个问题很奇怪,但我可以确认它确实存在。

使用正确安装并位于路径中的 matlab 预构建库时,我有时会遇到相同的错误。如果我在命令行中输入函数名称,该函数将可见并且会自动完成。但是,在我“cd”到包含 .mexw64 库文件的目录之前,该函数不会初始化。

>> 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

事实证明,这是由于缺少依赖项造成的,而这些依赖项不应该缺少。要解决此问题,请使用 dependency walker(免费、轻量级)来确定缺少的内容。 mathworks 解释了这一点。

http://www.mathworks.com/support/solutions/en/ data/1-2R​​QL4L/

就我而言,两个 DLL 没有正确显示,即使它们位于我的系统上且位于路径中。我将 DLL 复制到 windows/system32 文件夹中,库函数现在可以正常工作了。特别奇怪的是,几天前(在移动 DLL 之前),同一个库在我的计算机上运行。

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).

贪了杯 2024-09-04 21:32:26

一般来说,MEX 文件应该可以跨不同版本的 Matlab 使用;特别是,它们应该是向前兼容的。你说得对;听起来像是dll的问题。

如果您使用 Visual Studio 构建它,它可能会链接到 Visual C++ 运行时。这是一组默认情况下未安装在 Windows 上的库。可以下载它的“可再发行版本”此处;让您的同事安装可以解决问题。如果这不起作用,您可以使用 Dependency Walker 检查是否有其他不满足的 DLL 依赖项。

通常,配置 Matlab 的“mex -setup”以使用与 Matlab 一起分发的 Lcc 编译器可能是解决此问题的方法,但 AFAIK 64 位 Windows 不支持它。

另外,你确定他有64位版本的Windows吗?

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?

猫七 2024-09-04 21:32:26

问题的另一个可能来源可能是您在调试模式下编译的。 Visual C++ 可再发行组件仅支持发布模式。

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

牛↙奶布丁 2024-09-04 21:32:26

Dll 是 MySql 访问的包装器。我们最终使用了 Matlab 的 ODBC 和 MySql Connector。

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文