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

18 visualizaciones (últimos 30 días)
dave
dave el 22 de Mayo de 2020
Comentada: dave el 22 de Mayo de 2020
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

Respuesta aceptada

James Tursa
James Tursa el 22 de Mayo de 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.
  1 comentario
dave
dave el 22 de Mayo de 2020
Thanks for the quick response. I was not aware of that. I am using the same .dll

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Introduction to Installation and Licensing en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by