| Contents | Index |
libisloaded('libname')
libisloaded libname
libisloaded('libname') returns logical 1 (true) if the shared library libname is loaded and logical 0 (false) otherwise.
libisloaded libname is the command format for this function.
If you used an alias when initially loading the library, then you must use that alias for the libname argument.
Load the shrlibsample library and check to see if the load was successful before calling one of its functions:
addpath([matlabroot '\extern\examples\shrlib'])
loadlibrary shrlibsample shrlibsample.h
if libisloaded('shrlibsample')
x = calllib('shrlibsample', 'addDoubleRef', 1.78, 5.42, 13.3)
endSince the library is successfully loaded, the call to addDoubleRef works as expected and returns
x = 20.5000 unloadlibrary shrlibsample
Load the same library, this time giving it an alias. If you use libisloaded with the library name, shrlibsample, it now returns false. Since you loaded the library using an alias, all further references to the library must also use that alias:
addpath([matlabroot '\extern\examples\shrlib'])
loadlibrary shrlibsample shrlibsample.h alias lib
libisloaded shrlibsample
ans =
0
libisloaded lib
ans =
1
unloadlibrary lib| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |