Loading the Library in SBM AppScript

To load a DLL in SBM AppScript, you first need to create an SBM Library object using the CreateObject function call.

Dim sbmLib
Set sbmLib = CreateObject ("SBMLibrary")

Once the object is created, tell the object which DLL you want to call functions in by calling SetLibraryName on the SBMLibrary object. You can specify the path in one of three ways.

Additionally, if you are going to use an absolute path to specify the library to load, you must also include the extension. The extension is not assumed when using an absolute path; it is only assumed if you are going to rely on the ScriptAppPath.

Once you have told the library object which library you want to load, call LoadLibrary to actually get the library loaded. For example:

Call sbmLib.LoadLibrary()

LoadLibrary() returns a Boolean which indicates the success or failure of the operation. To avoid experiencing a runtime exception, always check the return value of LoadLibrary() prior to calling any functions in the DLL. For example:

If sbmLib.LoadLibrary()  Then
	Call sbmLib.my_function()
End If