How can I call a *.dll file on a Mac?

18 次查看(过去 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

采纳的回答

James Tursa
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.
  1 个评论
dave
dave 2020-5-22
Thanks for the quick response. I was not aware of that. I am using the same .dll

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile 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!

Translated by