| External Interfaces/API Reference | ![]() |
Determine if external library is loaded
Syntax
Description
libisloaded('libname')
returns true if the shared library libname is loaded and 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.
Example 1
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.dll shrlibsample.h if libisloaded('shrlibsample') x = calllib('shrlibsample', 'addDoubleRef', 1.78, 5.42, 13.3) end
Since the library is successfully loaded, the call to addDoubleRef works as expected and returns
Example 2
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.dll shrlibsample.h alias lib libisloaded shrlibsample ans = 0 libisloaded lib ans = 1 unloadlibrary lib
See Also
loadlibrary, libfunctions, libfunctionsview, libpointer, libstruct, calllib, unloadlibrary
| libfunctionsview | libpointer | ![]() |
Learn more about the latest releases of MathWorks products: |
| © 1994-2009 The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |