SBM AppScript Reference → Additional SBM AppScript Features → Calling Functions in a DLL from SBM AppScript → Keeping a Library Loaded Across Script Executions
For performance reasons, you may wish to keep a DLL loaded after your script has finished executing. That way the DLL is already loaded the next time the script executes. To do this, simply check to see if the library has been loaded by calling IsLibraryLoaded() before calling LoadLibrary(). If the library is not loaded, call LoadLibrary() to load it for the first time. As long as your script doesn't call FreeLibrary(), it remains loaded for the next time your script executes.
Dim ttLib Dim arg2 Dim path Set ttLib = CreateObject( "TeamTrackLibrary" ) path = "d:/powderhorn/Tools/ScriptTestTools/build/Release/ Win32DllTest.dll" ttLib.SetLibraryName( path ) if Not ttLib.IsLibraryLoaded() Then If Not ttLib.LoadLibrary() Then Call Ext.WriteStream( _ "<font color=red><b>Test Failed: Unable to load library " _ & "on </b>" ) Call Ext.WriteStream( path ) Call Ext.WriteStream( "</font>\r\n" ) Else Call Ext.WriteStream( "<b>Library load succeeded on ") Call Ext.WriteStream( path ) Call Ext.WriteStream( "</b><br>\r\n" ) End If Else Call Ext.WriteStream( "Library already loaded<br>" ) End If
Copyright © 2007–2015 Serena Software, Inc. All rights reserved.