Error at calling *.dll file in Matlab

4 ビュー (過去 30 日間)
Jong-Hwan Kim
Jong-Hwan Kim 2012 年 5 月 6 日
回答済み: Ray 2015 年 12 月 10 日
Hi,
I want to use icp.dll file in Matlab for a project. When I use my friend's laptop, which is 32 bit win7, Matlab 2009a. Matlab automatically recognize icp.dll and works fine. But, when I use my computer, 64 bit win7 Matlab 2011a, Matlab shows an error below.
=== error =====
loadlibrary('icp.dll','icp.h')
??? Error using ==> loadlibrary at 441
Failed to preprocess the input file.
Output from preprocessor is:icp.h
C:\matlab\test\icp.h(329) : error C2006:
'#include' : expected a filename, found 'identifier'
C:\matlab\test\icp.h(329) : fatal error
C1083: Cannot open include file: '': No such file or directory
=== error =====
Actually I don't have icp.h file, I only have icp.dll file. I really want to compile icp.dll file in MATLAB.
I hope you guys have an answer.
Thank you
[Merged information from duplicate question]
Hi,
I have icp.dll file, which works fine in 32bit win7 and Matlab 2009b, while it shows an error in 64bit Matlab 2011a.
===error====
??? Undefined function or method 'icp' for input arguments of type 'double'.
Error in ==> practice_ICP_NDT_01 at 87
delta = icp(p1, p2icp, delta, GATE1, NIT, INTERP)
===error====
Matlab seems not to recognize the icp.dll file so I commanded that
>> loadlibrary('icp.dll')
??? Error using ==> loadlibrary>lFullPath at 613
Could not find file icp.h.
Error in ==> loadlibrary at 226
header=lFullPath(header);
>> calllib('icp.dll')
??? Error using ==> calllib
To call a function both the library name and function name are needed.
I don't know how I can solve this problem and use icp.dll in Matlab Thanks.
  2 件のコメント
Kaustubha Govind
Kaustubha Govind 2012 年 5 月 7 日
The LOADLIBRARY command needs either a header or generated prototype file (.m) corresponding to the DLL. If you don't have icp.h, how did you load it on your friend's machine?
Also, note that you will need 32-bit MATLAB to load a 32-bit DLL.
Walter Roberson
Walter Roberson 2012 年 5 月 7 日
Your duplicate question has been merged into the above. You may wish to review it and edit out any redundant information.

サインインしてコメントする。

採用された回答

Kaustubha Govind
Kaustubha Govind 2012 年 5 月 7 日
Ah! It looks like you are using a MEX-function which used to have a .dll extension in very old releases of MATLAB. They now have extensions like mexw32, mexw64, etc. You can call these files directly like any other MATLAB function - there is no need to use LOADLIBRARY.
In any case, the issue is that MEX-files are platform-specific - the one you have is compiled for 32-bit Windows, so it won't be recognized on 64-bit MATLAB. If you have the source code corresponding to the file, you can use the MEX command to re-compile it for 64-bit Windows. Alternately, you can install 32-bit MATLAB on your 64-bit machines to run the 32-bit MEX-file. See How can I install 32-bit MATLAB on my 64-bit Windows machine?
  4 件のコメント
Jong-Hwan Kim
Jong-Hwan Kim 2012 年 5 月 7 日
I see, thank you for additional advise. I appreciate that :)
Jong-Hwan Kim
Jong-Hwan Kim 2012 年 5 月 8 日
Finally, it worked well. Thank you very much

サインインしてコメントする。

その他の回答 (3 件)

Ray
Ray 2015 年 12 月 10 日
I am wondering how do you fix this problem, by installing a 32 bit Matlab or other methods. Because I only have the .dll file without the .h file, and in the similar situation like yours.
Look forward to your reply

Walter Roberson
Walter Roberson 2012 年 5 月 6 日
Windows does not know the character "~" as a directory name: that character is used by the Unix (Linux, OS-X) shells to mean "the user's home directory". You need to track down where that "~" is coming from: did you
cd ~
for example? Or is there an icp.h file that has a #include statement that uses it?
  1 件のコメント
Jong-Hwan Kim
Jong-Hwan Kim 2012 年 5 月 6 日
I am sorry that I used '~' instead of 'matlab\test'. I fixed it.
icp.dll file locates at 'c:\matlab\test\' Thanks.

サインインしてコメントする。


Walter Roberson
Walter Roberson 2012 年 5 月 7 日
Is icp.dll a product of the company Softlog ? If so then the software was strictly 32 bit and cannot be used from the 64 bit version of MATLAB.

カテゴリ

Help Center および File ExchangeMATLAB Compiler についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by