- Static libraries can't be loaded using loadlibrary. You have to convert it to a dll before using it. I've also read from another question's answer that one way to do this is to create a mex file that calls the function in the library.
- The error also suggests a possiblity that that a 64 bit operating system is trying to load a 32 bit Win32 file. Follow this answer to use the workaround. https://www.mathworks.com/matlabcentral/answers/99364-how-do-i-resolve-loadlibrary-failed-with-error-193-1-is-not-a-valid-win32-error-message-in-simul
Error with using loadlibrary() with .lib file
10 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I'm trying to get MATLAB to load the library of an NI library file (.lib) named FlexMS32.lib. I downloaded the 32-bit MATLAB R2015b environment so it could interface with the file. However, when I try to load it, it returns this error:
Error using loaddefinedlibrary
...FlexMS32.lib is not a valid Win32 application.
I have no idea why it's returning this error. This is all the code I'm running:
loadlibrary('FlexMS32.lib', 'flexmotn.h', ...
'addheader', 'flexcomp.h', ...
'addheader', 'MotnCnst.h', ...
'addheader', 'MotnErr.h', ...
'addheader', 'nimcBasicTypes.h' ...
);
0 comentarios
Respuestas (1)
Gyan Vaibhav
el 7 de Mzo. de 2024
Hi Mark,
If you could provide the lib file it would be easier for me to determine the error. However, looking at the error, I feel there are two possible reasons for this.
Hope this helps.
Thanks
Gyan
0 comentarios
Ver también
Categorías
Más información sobre MATLAB Compiler en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!