Still having problems loading libraries with 2015a and windows 10

12 views (last 30 days)
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?

Answers (2)

Shruti Sapre
Shruti Sapre on 1 Sep 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 Comment
Tim G.
Tim G. on 1 Sep 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.

Sign in to comment.


Walter Roberson
Walter Roberson on 1 Sep 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 Comment
Philip Borghesani
Philip Borghesani on 2 Sep 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.

Sign in to comment.

Categories

Find more on C Shared Library Integration in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!