How to unload a library linked to a S-Function ?

조회 수: 13 (최근 30일)
p fontaine
p fontaine 2017년 8월 31일
댓글: p fontaine 2017년 9월 7일
I have built a S-Function with S-Function builder (R2015a 32 bits on windows, compiler Visual Studio C++ Pro 10) This S-Function is linked with a static library (.lib) of legacy code which opens a file during execution. Eventhough I type on the command line clear mex clear *.mewx32 clear *.lib the file opened by this library seems to remain linked to the Matlab Runtime
My problem is indeed that this library does not close properly a file, then 2 consecutive simulation runs under simulink produce a crash because the file remains open. The only workaround I have found is to restart Matlab. Is there a better solution ?

답변 (1개)

Amit Doshi
Amit Doshi 2017년 9월 6일
You can use the 'unloadlibrary' function in MATLAB to unload shared library from memory.
Refer the below link to know more about the 'unloadlibrary' function in MATLAB:
  댓글 수: 1
p fontaine
p fontaine 2017년 9월 7일
My question was about a statically linked library (.lib) and not a dynamically linked library (.dll) ...

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

카테고리

Help CenterFile Exchange에서 Simulink Environment Customization에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by