Load C/C++ shared library into MATLAB - '.dll is not a valid Win32 application'

14 visualizzazioni (ultimi 30 giorni)
Thank you in advance.
I tried to load a C library (as enclosed) into matlab and got an error 'dll is not a valid Win32 application' as follows. May ask what is the issue and how can I resolve it ?
% load SDK
addpath(fullfile(matlabroot,'extern','ifmO3D'))
if not(libisloaded('pmdaccess2'))
loadlibrary('pmdaccess2','pmdsdk2common.h','addheader','pmddatadescription.h','addheader','pmdsdk2.h')
end
libfunctions('pmdaccess2')
.............Error ...........................
In loadlibrary
In ifm_O3D_Interface (line 8)
Error using loadlibrary
There was an error loading the library "C:\Program Files\MATLAB\R2016a\extern\ifmO3D\pmdaccess2.dll"
C:\Program Files\MATLAB\R2016a\extern\ifmO3D\pmdaccess2.dll is not a valid Win32 application.
Error in ifm_O3D_Interface (line 8)
loadlibrary('pmdaccess2','pmdsdk2common.h','addheader','pmddatadescription.h','addheader','pmdsdk2.h')
Caused by:
Error using loaddefinedlibrary
C:\Program Files\MATLAB\R2016a\extern\ifmO3D\pmdaccess2.dll is not a valid Win32 application.

Risposte (1)

Pico Technology
Pico Technology il 12 Ott 2016
Hi Seungkook,
Is the dll that you are attempting to load a 64-bit version? If not this is likely to be the issue as MATLAB 2016a is only available as a 64-bit version.
You may also need to set up a 64-bit compiler and call
mex -setup

Categorie

Scopri di più su C Shared Library Integration in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by