how do i load dll files with loadlibrary function?

hi guys (and girls :) )... I am working with DSP board from Texas Instruments. I wrote a code on Matlab so I can use this board in my specific way.
I am having an error at the beginning of my code. I need to load the dll files with "loadlibrary" function. the beginning of the code is:
if ~libisloaded('wvdll')
clear all
disp('clear all')
% hfile = fullfile('C:\Users\mojob1\Desktop\dsp\ADC_Project','wvdll.dll');
% loadlibrary('wvdll',hfile)
[notfound, warnings] = loadlibrary('wvdll','wvdll.dll','wvdll.h','mfilename');
%[notfound, warnings] = loadlibrary('wvdll','wvdll.h');
libfunctions('wvdll');
end
and that's the error that I got: Error using loadlibrary (line 153) Option wvdll.h is not a valid loadlibrary option.
Error in Main (line 15) [notfound, warnings] = loadlibrary ('wvdll','wvdll.dll','wvdll.h','mfilename');
if some-one can help with that I will be more the grateful.
matan.

1 Comment

this link is where I got my dll files..
the zip file is: 1261.Programmers' Guide to WV5_DLL API r0p9.zip
thanks matan

Sign in to comment.

Answers (1)

Check out the documentation for loadlibrary at http://www.mathworks.com/help/matlab/ref/loadlibrary.html. Your line of code
loadlibrary('wvdll','wvdll.dll','wvdll.h','mfilename');
raises the error Option wvdll.h is not a valid loadlibrary option because this line is using the header file as the third input which is reserved for the name-value (as fourth input) pair arguments. Since the name of the header file is the same as the dll, try using just
loadlibrary('wvdll');
making sure the path to the dll has been added to the search path. See http://www.mathworks.com/help/matlab/ref/loadlibrary.html#btgwwzn for an example.

8 Comments

first of all thanks for responding. I tried many lines... and I keep getting the same errors. I tried:
[notfound,warnings]=loadlibrary('wvdll.dll','wvdll.h','mfilename','mHeaderc');
I also tried:
[notfound,warnings]=loadlibrary ('wvdll')
and the error I got is:
Error using loadlibrary (line 419)
There was an error loading the library "C:\Users\mojob1\Desktop\rf
photonic\mpi\dsp\ADC_Project\wvdll\wvdll.dll"
Error in Main (line 13)
[notfound, warnings] = loadlibrary('wvdll.dll','wvdll.h','mfilename',
'mHeaderc')
Caused by:
Error using loaddefinedlibrary
and the other error for the second line was:
Error using loadlibrary (line 419)
There was an error loading the library "C:\Users\mojob1\Desktop\rf
photonic\mpi\dsp\ADC_Project\wvdll\wvdll.dll"
about the tip that u gave me just to try loadlibrary (wvdll); the matlab gave me an error to add [notfound, worning].
so what sould I do next?
if it will possible and someone have some "free-time" that's my Skype name and I get share screen with someone... Skype name: matanantebi thanks
What happens when you run the command
[notfound,warnings] = loadlibrray('wvdll');
when I'm trying it the error I get is:
Error using loadlibrary (line 253) A 'Selected' compiler was not found. You may need to run mex -setup.
Error in Main (line 15) [notfound, warnings] = loadlibrary('wvdll');
when I'm trying to do mex - setup I get another error.
No supported SDK or compiler was found on this computer. For a list of supported compilers, see http://www.mathworks.com/support/compilers/R2013b/win64.html
Undefined function or variable 'setup'.
and when I am trying to download some new version of SDK some problem comes up...
:/
What does mex.getCompilerConfigurations('C','Selected') return? Have you checked http://e2e.ti.com/support for similar queries of using MATLAB and this dll?
when I tried your line mex.getCompilerConfigurations I keep getting the same error a compiler was not found...
and the link http://e2e.ti.com/support isn't opening...
As for setting up mex, there is no space between the dash and setup like you have above. It is just
mex -setup
So you can try that again.
first of all thanks for everything! now I have the Microsoft SDK 7.1, and I also have the .NET framework 4.0 and 4.5. and I have compilers on my computer.
now I have another problem. my Matlab is 64 bit (I check it with the line mexext. the dll files which I have are 32 bit. so I get an error which say that it doesn't know how to work with dll 32 bit files when my Matlab 2013b is 64 bit.
this is my new error:
Error using loadlibrary (line 421)
There was an error loading the library
"C:\matan\moran\ADC_Project\wvdll.dll" ??C:\matan\moran\ADC_Project\wvdll.dll ???? ???? ?????? Win32?.
Error in Main (line 16)
[notfound, warnings] = loadlibrary('wvdll');
Caused by:
Error using loaddefinedlibrary
??C:\matan\moran\ADC_Project\wvdll.dll ???? ???? ??????
Win32?.
so my questions are: 1) do I understand correctly that the problem is because I have Matlab 64bit and the dll files are 32 bit? 2) do I need to download a Matlab of 32 bit? or the installation at the end will ask me if I want 64 bit or 32 bit?
Matan.
The 64 bit MATLAB vs 32 bit dll could be the problem. You should look at the link http://e2e.ti.com/support/data_converters/high_speed_data_converters/f/68/t/224003.aspx which outlines a similar issue. As for your second question, I have no background to suggest what you should do there.

Sign in to comment.

Categories

Find more on MATLAB Compiler SDK in Help Center and File Exchange

Asked:

on 15 Jun 2014

Commented:

on 17 Jun 2014

Community Treasure Hunt

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

Start Hunting!