How can I call a *.dll file on a Mac?
7 views (last 30 days)
Show older comments
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 Comments
Accepted Answer
James Tursa
on 22 May 2020
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.
More Answers (0)
See Also
Categories
Find more on Introduction to Installation and Licensing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!