Still having problems loading libraries with 2015a and windows 10

1 visualización (últimos 30 días)
Tim G.
Tim G. el 28 de Ag. de 2015
Comentada: Philip Borghesani el 2 de Sept. de 2015
Further to my previous question, I tried following the example in the loadlibrary() help menu:
>> matlabroot
ans =
C:\Program Files\MATLAB\R2015a
>> addpath(fullfile(matlabroot,'extern','examples','shrlib'))
>> loadlibrary('shrlibsample')
Index exceeds matrix dimensions.
Error in loadlibrary>getLoadlibraryCompilerConfiguration (line 527)
Error in loadlibrary (line 263)
Can someone please explain why I can't even load the dll example that is in the matlab help? Is this a windows 10 compatibility problem?

Respuestas (2)

Shruti Sapre
Shruti Sapre el 1 de Sept. de 2015
Hi Tim,
I understand that you are trying to load the dll from example on the Mathworks help page. The error you mentioned could be due to absence of a supported compiler on your machine.
Please refer to the link below for limitations of “loadlibrary”:
The below command could help confirm the presence of a supported compiler:
>> mex setup
"mex" has to be setup to point to a supported compiler.
If there is no compiler installed, please install a supported compiler and try again. Here is a link that lists the supported compilers:
Hope this helps!
-Shruti
  1 comentario
Tim G.
Tim G. el 1 de Sept. de 2015
Shruti,
I am confused as to why i need to have a compiler installed on my system in order to open and access a pre-existing DLL.
Regardless, I have the sdk 7.1 and MS Visual Studio 2013 Professional installed. I also have perl installed.
When i type mex -setup i get an error
>> mex -setup
Error using mex
No supported compiler or SDK was found. For options, visit
http://www.mathworks.com/support/compilers/R2015a/win64.html.

Iniciar sesión para comentar.


Walter Roberson
Walter Roberson el 1 de Sept. de 2015
I have not yet seen any evidence that SDK 7.1 can be installed on Windows 10; there is a conflict with .NET versions that I have not seen resolved yet.
loadlibrary() that is not given a prototype file must be supplied with a .h file that lists the available routines and the datatypes of the output and of all of the inputs. It then requires a compiler (or at least pre-processor perhaps) to build from that a MATLAB-readable description that can be used to convert inputs and outputs in order to call the routine successfully.
When you succesfully use loadlibrary() with a header file, there is an option to output from that a prototype file which MATLAB can use instead without needing a compiler. That prototype file can be used on systems without compilers, or can be deployed with an application compiled with MATLAB Compiler. Therefor if you still have access to a Windows system with a compiler and with MATLAB, you could generate the prototype file on there and copy it to your Windows 10 system.
  1 comentario
Philip Borghesani
Philip Borghesani el 2 de Sept. de 2015
Walter is correct for 32 bit systems. On 64 bit systems a thunk file (dll) is also required to load the library. This file is automatically built from generated c code by the loadlibrary command using the configured compiler but can be copied and used on other systems that do not have a compiler.

Iniciar sesión para comentar.

Categorías

Más información sobre C Shared Library Integration 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!

Translated by