use loadlibrary with a C dll several times, then throw an error " Error using loaddefinedlibrary"
I use the follow syntex:
loadlibrary('CDLL', 'EXPORT.h', 'mfilename', 'mxCDLL');
unloadlibrary('CDLL');
for i=1:1000
dll_name = 'CDLL';
if ~libisloaded(dll_name)
loadlibrary(dll_name, @mxCDLL);
end
end
and when the loop proceed the 495 time, it stoped, and throw an error "
Error using loaddefinedlibrary".
please help me, thank you very much!
ps: the CDLL.dll is programed by CUDA C, and I just load it and do nothing else.
댓글 수: 8
Yes, it is extremely odd that libisloaded is false. Did you expect that your library would take a long time to load? Is that why you wrote the loop?
Could it be that at iteration 495, the library is finally loaded and thus loadlibrary complains?
You may want to monitor what is actually happening at the OS level with for example procmon.
Does the initialisation function of your library try to acquire resources that may be unavailable (hence, why it'd take a long time to load)?
To avoid us following red herrings, can you give us the exact code that you're testing with?
I don't know if it would help, but can you share your dll?
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!