Share via


How to: Access a Visual FoxPro Library

A Visual FoxPro library (.fll file), like a .dll file, contains functions you can call as you would any other function. It is generally easier to pass parameters to and from functions in .fll files because they are created specifically for calling from Visual FoxPro.

To use a Visual FoxPro library, register the .fll file by specifying the name of the .fll file with the SET LIBRARY Command command, and then call the function normally. Unlike registering .dll functions, you do not need to register individual functions in the .fll file, nor do you need to specify information about the parameters or data types used by the function.

Note

If you want to use an .fll library from an earlier version of Visual FoxPro, the library must be recompiled to work with Visual FoxPro version 5.0.

To call an .fll function

  1. Register the .fll library by issuing a SET LIBRARY command.

  2. Call the functions in the library as you would any function.

For example, the following code calls a function from the Foxtools.fll library in the Visual FoxPro installation directory to determine what type of drive the C: drive is:

SET LIBRARY TO "C:\Program Files\Microsoft Visual FoxPro 9.0\Foxtools.fll"
? DriveType("C:")

If you need to register more than one .fll file, include the ADDITIVE keyword in the SET LIBRARY command. If you don't, the previously registered .fll file is cleared and replaced by the one most recently registered.

If a function name conflicts with that of another function already available in Visual FoxPro, the last function defined takes precedence. If the function name in a linked library has the same name as that of an intrinsic Visual FoxPro function, the Visual FoxPro function takes precedence.

You only need to register functions in an .fll file once per session because they remain available until you quit Visual FoxPro. If you do not intend to call the functions in a .fll file again, remove the .fll file from memory and free resources by issuing the RELEASE LIBRARY, RELEASE ALL, or SET LIBRARY commands. For more information, see RELEASE LIBRARY Command and RELEASE Command.

See Also

Tasks

How to: Access Dynamic-Link Libraries

How to: Access ActiveX Controls and Objects

Concepts

Accessing External Libraries

Other Resources

Extending Visual FoxPro with External Libraries

Accessing the Visual FoxPro API