How can I call a *.dll file on a Mac?
조회 수: 3 (최근 30일)
이전 댓글 표시
Hi Everyone,
I have attempted to look this up online and through documentation, but it is not clear to me whether it is even possilbe to call a *.dll on Matlab for Mac.
When I'm on a PC I use the following and this works fine...
%r3dLibrary=
R3Dloaded = libisloaded('MatlabR3D'); %check if already loaded
if ~R3Dloaded
if isdeployed
loadlibrary('MatlabR3D', @MyMatlabR3D_D2);
else
loadlibrary('MatlabR3D.dll', 'MatlabR3D.h');
end
end
However, when i run the same lines of code on mac matlab i get the following errors when executing the loadlibrary command:
Error using loadlibrary
There was an error loading the library "/Users/Dave/Google
Drive/MatlabScripts/calGUI/MatlabR3D.dll"
dlopen(/Users/Dave/Google Drive/MatlabScripts/calGUI/MatlabR3D.dll, 6): no suitable image found.
Did find:
/Users/Dave/Google Drive/MatlabScripts/calGUI/MatlabR3D.dll: unknown file type, first
eight bytes: 0x4D 0x5A 0x90 0x00 0x03 0x00 0x00 0x00
/Users/Dave/Google Drive/MatlabScripts/calGUI/MatlabR3D.dll: unknown file type, first
eight bytes: 0x4D 0x5A 0x90 0x00 0x03 0x00 0x00 0x00
Caused by:
Error using loaddefinedlibrary
dlopen(/Users/Dave/Google Drive/MatlabScripts/calGUI/MatlabR3D.dll, 6): no suitable image
found. Did find:
/Users/Dave/Google Drive/MatlabScripts/calGUI/MatlabR3D.dll: unknown file type, first
eight bytes: 0x4D 0x5A 0x90 0x00 0x03 0x00 0x00 0x00
/Users/Dave/Google Drive/MatlabScripts/calGUI/MatlabR3D.dll: unknown file type, first
eight bytes: 0x4D 0x5A 0x90 0x00 0x03 0x00 0x00 0x00
What do i need to do differently?
I would appreciate any help or guidance
Thanks
댓글 수: 0
채택된 답변
James Tursa
2020년 5월 22일
dll's are compiled object code specific to the machine type they are compiled for. Are you trying to load the same dll file on your Mac that you used on your PC? That won't work. You need a different dll that is specifically compiled for the Mac.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!