SBM AppScript Reference → Additional SBM AppScript Features → Calling Functions in a DLL from SBM AppScript → Avoiding Exceptions
If you attempt to call a function on a library that was not successfully loaded, SBM AppScript throws a runtime exception. To avoid this, a good practice is to verify that the library is loaded before calling a function. For example:
Dim arg2 If ttLib.IsLibraryLoaded() Then arg2 = 10 Call ttLib.TestFunction( "arg1", arg2 ) End If
The following table lists the functions for calling a DLL from SBM AppScript.
Function |
Description |
---|---|
SetLibraryName(string libname) |
This subroutine tells the SBM library object which DLL you are going to load and call functions in. This subroutine does not return any values. |
Boolean IsLibraryLoaded() |
This function returns true if the library has already been loaded. This function throws a runtime exception if SetLibraryName() has not previously been called for this object or if any arguments were passed to this function. |
Boolean LoadLibrary() |
This function loads the DLL and returns true if the DLL was successfully loaded or false otherwise. Typically, a failure to load the DLL means the DLL could not be located. Check paths and spelling. This function throws a runtime exception if SetLibraryName() has not previously been called for this object or if any arguments were passed to this function. This function may also throw a runtime exception if the operating system is unable to load the DLL. Check the event viewer for detailed information. |
Boolean FreeLibrary() |
This function frees a previously loaded DLL. This function returns true if the DLL was successfully unloaded and false otherwise. If false is returned, you may check the event viewer for more detailed information. This function throws a runtime exception if SetLibraryName() has not previously been called for this object or if any arguments were passed to this function. |
Copyright © 2007–2015 Serena Software, Inc. All rights reserved.