AddToLibraryList PowerScript function
Description
Adds new files to the library search path of an application
or component at runtime.
Syntax
|
1 |
<span>AddToLibraryList</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 or component is being run in the PowerBuilder development
environment, rather than from a standalone executable or server. -
-2
The new library list or existing library list is empty, or
another internal error has occurred.
Usage
When an 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. For a deployed
component, PowerBuilder searches the PBD files in the component’s
library list. You can specify additional library files with AddToLibraryList.
Calling AddToLibraryList appends a new
list of files, in the order in which they are specified in filelist,
to the list of library files specified in the target. If filelist contains
a file name that is already in the library list, that file name
is not added to the library list. If filelist contains
more than one occurrence of a given file name, the first occurrence
is added to the library list.
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.
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 or component
needs.
This function has no effect in the PowerBuilder development
environment.
Examples
This example adds different PBDs to the library search
path depending on whether product or customer processing is to be
performed:
|
1 |
CHOOSE CASE processkind<br>   CASE "product"<br>      <span>AddToLibraryList</span>(prod.pbd)<br>   CASE "customer"<br>      <span>AddToLibraryList</span>(cust.pbd)<br>END CHOOSE |