calllib crashes Matlab... no error given
5 次查看(过去 30 天)
显示 更早的评论
Greetings. I am trying to use some functions in a dll, but when I use calllib, Matlab crashes (and closes) without error.
Any idea what is going on?
EDIT: I just noticed that I got a warning(s) when I loaded the library.
Warning: Eval of const expression 10 ][ 1024 failed with error Unmatched right square bracket at (eval 5) line 1, at end of line syntax error at (eval 5) line 1, near "10 ]" Missing right curly or square bracket at (eval 5) line 2, at end of line
The offending line is...
char gnFn[10][1024];
???
采纳的回答
tlawren
2011-11-2
1 个评论
rubina mahtab
2016-12-7
I have the same issue as yours. But what I want matlab to do is to pop up a window saying license file missing, instead of crashing and without giving a proper error. I tried using try and catch but matlab still crashes. do you have any suggestion?
更多回答(1 个)
Philip Borghesani
2011-10-17
The usual cause of a calllib call causing MATLAB to exit with no stack trace is the use of the wrong calling convention. loadlibrary defaults to cdecl but many 32 bit libraries are built with stdcall as the default calling convention.
Another is to modify the c header file to properly state the calling convention and rebuild if needed.
3 个评论
Philip Borghesani
2011-10-19
Without more information is unlikely that we can help you. The amount of information needed probably belongs in a tech support call not this area.
Needed information
# Matlab version
# copy of header file
# copy of DLL
# full text/error output from your call to loadlibrary and any calllib calls.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!