SetLibraryList PowerScript function
Description
Changes the files in the library search path of the application
at runtime.
Obsolete syntax
You can still use the old syntax with the name of the application
object before the function call: applicationname.SetLibraryList ( filelist).
Syntax
|
1 |
<span>SetLibraryList</span> ( <span>filelist</span> ) |
|
Argument |
Description |
|---|---|
|
filelist |
A comma-separated list of file names. |
Return Values
Integer. Returns 1 if it succeeds. If
an error occurs, it returns:
-
-1
The application is being run from PowerBuilder, rather than
from a standalone executable. -
-2
A currently instantiated object is in a library that is not
on the new list. If any argument’s value is null, SetLibraryList returns null.
Usage
When your application needs to load an object, PowerBuilder
searches for the object first in the executable file and then in
the dynamic libraries specified for the application. You can specify
a different list of library files from those specified in the executable
with SetLibraryList.
To avoid problems that can occur when components share resources,
you should use AddToLibraryList instead of SetLibraryList to
add additional PBD files to the search list of a component deployed
to EAServer.
Calling SetLibraryList replaces the list
of library files specified in the executable with a new list of
files. For example, you might use SetLibraryList to
configure the library list for an application containing many subsystems.
You should always use GetLibraryList to return
the current library search path and then append any files you want
to add to this list. You can then pass the complete list in the filelist argument.
PowerBuilder cannot check whether the libraries you specify
are appropriate for the application. It is up to you to make sure
the libraries contain the objects that the application needs.
The executable file is always first in the library search
path. If you include it in filelist, it is
ignored.
If you are running your application in the PowerBuilder development environment,
this function has no effect.
Examples
This example specifies different files in the library
search path based on the selected application subsystem:
|
1 |
string ls_list<br> |
|
1 |
ls_list = getlibrarylist ()<br>CHOOSE CASE configuration<br>   CASE "Config1"<br>      <span>SetLibraryList</span>(ls_list + ",lib1.pbd, lib2.pbd, &<br>         lib5.pbd")<br>   CASE "Config2"<br>      <span>SetLibraryList</span>(ls_list + ",lib1.pbd, lib3.pbd, &<br>         lib4.pbd")<br>END CHOOSE |