SetLibraryList

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

SetLibraryList ( filelist )

Argument

Description

filelist

A comma-separated list of file names. Specify the full file name with its extension. If you do not specify a path, PowerBuilder uses the system's search path to find the file.


Return value

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.

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:

string ls_list

ls_list = getlibrarylist ()
CHOOSE CASE configuration
   CASE "Config1"
      SetLibraryList(ls_list + ",lib1.pbd, lib2.pbd, &
         lib5.pbd")
   CASE "Config2"
      SetLibraryList(ls_list + ",lib1.pbd, lib3.pbd, &
         lib4.pbd")
END CHOOSE 

See also

AddToLibraryList

GetLibraryList