Share via


SET LIBRARY Command

Opens an external API (application programming interface) library file.

SET LIBRARY TO [FileName [ADDITIVE]]

Parameters

  • FileName
    Specifies the file name of the API library or procedure file to open.

    Visual FoxPro assume an .fll extension for libraries. If the library has an .fll extension, you don't have to include the extension with the file name. If a library has an extension other than .fll, you must include the extension with the file name.

    Warning

    When using SET LIBRARY, be aware of the following:

    • You cannot use API libraries built for one platform on another platform. For example, libraries created for FoxPro for MS-DOS cannot be used in Visual FoxPro; libraries created for Visual FoxPro cannot be used in FoxPro for MS-DOS.

    • You cannot use API libraries built for one version on another version. For example, you cannot use libraries built for FoxPro version 2.6 in Visual FoxPro. You must recompile and link.

    Visual FoxPro assumes a .prg extension for a procedure file.

    When you execute a procedure with DO ProcedureName, Visual FoxPro searches for the procedure in the following files in this order:

    • The file containing DO ProcedureName.

    • A procedure file opened with SET PROCEDURE (if one is set).

    • The programs in the execution chain. Visual FoxPro searches program files beginning with the most recently executed program and continuing back to the first executed program.

    • A procedure file opened with SET LIBRARY (if one is set).

    • A stand-alone program file. If Visual FoxPro finds a program file with the same name as the file name specified with DO, the program is executed. If it doesn't find a matching program file name, Visual FoxPro generates an error message.

  • ADDITIVE
    Opens additional API libraries. Include ADDITIVE after the file name in successive SET LIBRARY commands.

    Visual FoxPro ignores ADDITIVE when you use SET LIBRARY to open a procedure file.

Remarks

Use SET LIBRARY to open external Application Program Interface (API) libraries or a procedure file.

API routine libraries extend the capabilities of the Visual FoxPro language and user interface. Once an external API library is opened, you can use the API functions as if they were Visual FoxPro functions. Use DISPLAY STATUS or LIST STATUS to display the library's available functions.

You can use existing API libraries or create your own API libraries.

In Visual FoxPro, the preferred way to register functions in shared libraries is to use the DECLARE - DLL command.

To remove all API libraries from memory, use SET LIBRARY TO without including FileName or ADDITIVE. To remove an individual library from memory, use RELEASE LIBRARY LibraryName.

If you specify a procedure file, the procedures within the procedure file are made available to all programs and are also available interactively through the Command window.

Note

The ability of Visual FoxPro to open a procedure file with SET LIBRARY provides compatibility with dBASE IV. Using SET LIBRARY to open a procedure file will close all open API libraries. Using SET LIBRARY to open API libraries will close a procedure file opened with SET LIBRARY. Use SET PROCEDURE to open a procedure file and prevent API libraries from being closed.

For additional information about procedure files, see PROCEDURE and SET PROCEDURE.

See Also

Reference

CALL Command

DISPLAY STATUS Command

LIST Commands

LOAD Command

RELEASE LIBRARY Command

SET Command Overview

Other Resources

Commands (Visual FoxPro)

Language Reference (Visual FoxPro)