MATLAB Answers

Help with reading the functions inside a library

43 views (last 30 days)
Jason
Jason on 16 Jan 2021
Commented: Jason on 17 Jan 2021
Is there a reason why the code below cannot find the dll that IS in the directory as shown (there is also the h file with the same name)
[file,path] = uigetfile('C:\Users\Public\PI\PI_Programming_Files_PI_GCS2_DLL\*.dll');
libname=fullfile(path,file)
%Remove the extension
[path,name,ext] = fileparts(libname)
%Rebuild without Ext
libname=fullfile(path,name)
hname=fullfile(path,name) %Dont need this if same name
loadlibrary('libname')
libfunctionsview libname
Error using loadlibrary
Could not find file libname.h.
Error in loadlibrary
(here are the library and header files)

  0 Comments

Sign in to comment.

Accepted Answer

Rik
Rik on 16 Jan 2021
You first store a filename in a variable, but then you use the Name of the variable to call loadlibrary.
loadlibrary(libname);%this should work better

  6 Comments

Show 3 older comments
Rik
Rik on 17 Jan 2021
From your screenshot it looks like your header file doesn't actually have an extension, while the error indicates Matlab expects a .h file. But glad you solved it.
Jason
Jason on 17 Jan 2021
Forgive me, but what does 'thunk it' mean

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by