how do i load dll files with loadlibrary function?

17 views (last 30 days)
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
matan
matan on 15 Jun 2014
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)

Geoff Hayes
Geoff Hayes on 15 Jun 2014
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
matan
matan on 17 Jun 2014
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.
Geoff Hayes
Geoff Hayes on 17 Jun 2014
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

Community Treasure Hunt

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

Start Hunting!