For some reason I have an error that says "Error using calllib Library was not found" yet I know it is in the MATLAB generals file, I even added the path manually to ensure my files are going there and it still can not find it. I was hoping to have some help if someone knows what the issue is, they would let me know what is up. Thanks!

댓글 수: 5

Image Analyst
Image Analyst 2014년 1월 26일
Hard to say without seeing any code, don't you think? What if you specify the full file name with fullfile() before you call loadlibrary()?
Hello, I'm sorry if it did not make since or something, I had two responses that said essentially, need more info, but it was the matlab example, found here:
if ~libisloaded('shrlibsample')
addpath(fullfile(matlabroot,'extern','examples','shrlib'))
loadlibrary('shrlibsample')
end
libfunctionsview shrlibsample
struct.p1 = 4; struct.p2 = 7.3; struct.p3 = -290;
[res,st] = calllib('shrlibsample','addStructByRef',struct);
res
For whatever reason I can not seem to use calllib. Still says the library is not found. I don't know why... That is why I was seeing if it was something someone else ran into.
You might have to compile the example first.
If you
cd(fullfile(matlabroot,'extern','examples','shrlib'))
then what does
ls
report as being present? And are you using 32 bit MATLAB or 64 bit MATLAB? With which operating system?
Chris E.
Chris E. 2014년 1월 27일
Thanks I think that did it (somehow)... I'm using 64 but now it is not running into the same issue. thanks
Chris Bresee
Chris Bresee 2022년 1월 5일
편집: Chris Bresee 2022년 1월 5일
Just for future people who may have a similar problem: Try adding the directory to your Windows environment system variables, either directly or in matlab, with: setenv('LibraryName', 'c:\Your\Install\Path\Library')

댓글을 달려면 로그인하십시오.

 채택된 답변

Walter Roberson
Walter Roberson 2014년 1월 26일

0 개 추천

You are generating 32 bit libraries and trying to use them on a 64 bit MATLAB. Or the moon is still in the 6th house and Jupiter has not quite aligned with Mars. Take your pick; one is as good as another with the information you gave us.

댓글 수: 1

Chris E.
Chris E. 2014년 1월 27일
Thanks for letting me know, but the code was the example of MATLAB's calllib. it just is not working. I was seeing if someone else ran into this problem. Sorry if it was not enough info, but it was the simple example that MATLAB website gave. However Jupiter was not quite lined up with mars, so it could of been that.....

댓글을 달려면 로그인하십시오.

추가 답변 (3개)

Image Analyst
Image Analyst 2014년 1월 27일

0 개 추천

Worked for me. Can you go here C:\Program Files\MATLAB\R2013a\extern\examples\shrlib and tell us what files you see? Change the version number if you need to, and change Program Files to Program Files (x86) if you have a 64 bit system but are running 32 bit MATLAB. You should see shrlibsample.mexw64, shrlibsample.c, and shrlibsample.h.
Chris Bresee
Chris Bresee 2022년 1월 5일
편집: Chris Bresee 2022년 1월 5일

0 개 추천

I had a similar problem. I was adding .dll and .lib files to my matlab path, but had forgotten to add them to my Windows path. Try: setenv('CEDS64ML', 'c:\Your\Install\Path\CEDS64ML');
parisa
parisa 2024년 10월 19일

0 개 추천

Error using calllib
Library was not found

댓글 수: 1

Image Analyst
Image Analyst 2024년 10월 21일
This is not an Answer. If you have any questions, then ask them, and attach your data and code to read it in with the paperclip icon after you read this:

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Call C from MATLAB에 대해 자세히 알아보기

태그

질문:

2014년 1월 26일

댓글:

2024년 10월 21일

Community Treasure Hunt

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

Start Hunting!

Translated by