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

18 ビュー (過去 30 日間)
dave
dave 2020 年 5 月 22 日
コメント済み: dave 2020 年 5 月 22 日
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 Center および File ExchangeIntroduction 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