本文介绍了Matlab的libifcoremd.dll中缺少符号'for_realloc_lhs'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用ifort构建了toto.dlltoto.lib(英特尔2017更新4 fortran编译器).然后,我使用mex matlab的编译器生成了几个文件.

I built a toto.dll and a toto.lib with ifort (Intel's 2017 update 4 fortran compiler). Then I used mex matlab's compiler to produce several mexw64 files.

使用mex时,我链接到toto.lib.然后,我在matlab 2017a 64位(在Win10 64位下)中运行了一个.m文件(matlab文件),此文件使用的是我编译的各种mexw64中的函数.

When I used mex I linked to toto.lib. Then, I ran a .m file (matlab file) inside matlab 2017a 64bits (under win10 64bits), an this file is using functions from the various mexw64's I compiled.

在matlab文件中,第一次调用该函数时出现以下错误:

In the matlab file, at the first call of such function I got the following error :

Invalid MEX-file 'C:\path\to\mexfile.mexw64': Missing symbol 'for_realloc_lhs'
in 'C:\Program Files\MATLAB\R2017a/bin/win64\libifcoremd.dll' required by 'C:\path\to\mexfile.mexw64'.

我的fortran编译器是intel fortran 2017更新4.

My fortran compiler is intel fortran 2017 update 4.

我发现了这个:

https://software.intel.com/zh-CN/forums/intel-visual-fortran-compiler-for-windows/topic/726858

但这对我没有太大帮助:

but it does not help that much as for me :

  • 用intel fortran代替matlab dll是不可行(也不正确)的解决方案(它掩盖了真正的问题)
  • 询问数学作品到目前为止没有任何答案……(因此我的帖子在这里)
  • replacing the matlab dll by the intel fortran is not a viable (nor correct) solution (it hides the real problem)
  • asking mathworks yielded no answer so far ... (hence my post here)

我不能以某种方式告诉matlab首先在intel fortran目录中寻找libifcoremd.dll',而不是在matlab目录中寻找吗? (我在.m文件中尝试了addpath,但没有成功.)我该怎么办?

Can't I somehow tell to matlab to look for the libifcoremd.dll' in the intel fortran directory first, instead of looking in the matlab directory ? (I tried addpath inside the .m file, without success.) What should I do ?

推荐答案

如果Matlab在与Matlab可执行文件相同的文件夹中包含libifcoremd.dll,这对他们来说是一件可怕的事情,那么您将无法覆盖它.我的建议是从该位置删除Intel编译器DLL,尽管它们可能会在更新后返回.

If Matlab includes libifcoremd.dll in the same folder as the Matlab executable, which is a horrible thing for them to do, you can't override it. My advice would be to delete the Intel compiler DLLs from that location, though they will likely return on an update.

如果它们位于以PATH命名的单独文件夹中,请确保Intel文件夹位于PATH的首位.

If they're in a separate folder named on PATH, make sure that the Intel folder is first on PATH.

可能最好的方法是构建要与静态库链接的DLL(Fortran>库>使用运行时库>多线程(/MT)).这样,您就不会受到Matlab不良行为的摆布.仅当DLL的调用者不是Fortran时,我才建议这样做.

Probably the best approach for you is to build your DLL to be linked against the static libraries (Fortran > Libraries > Use Run-Time Library > Multithreaded (/MT)). Then you won't be at the mercy of Matlab's bad behavior. I recommend this only when the caller of your DLL is not Fortran.

这篇关于Matlab的libifcoremd.dll中缺少符号'for_realloc_lhs'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-22 04:01