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

13 vues (au cours des 30 derniers jours)
Seungkook Jun
Seungkook Jun le 2 Sep 2016
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.

Réponses (1)

Pico Technology
Pico Technology le 12 Oct 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

Catégories

En savoir plus sur C Shared Library Integration dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by