Partilhar via


Accessing a Visual FoxPro Library

Like a DLL, a Visual FoxPro library (.fll file) contains functions you can call as you would any other function. Because .fll files are created specifically to be called from Visual FoxPro, it's generally easier to pass parameters to and from .fll functions.

To use a Visual FoxPro library, you specify the name of the .fll file, then call the function normally. Unlike registering DLL functions, you don't need to register individual functions within 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 function by issuing a SET LIBRARY command.
  2. Call any of the functions in the library as you would any function.

For example, the following program calls a function from the Foxtools.fll library to determine what type of drive the C: drive is:

SET LIBRARY TO "C:\Program Files\Microsoft ;
Visual FoxPro 7.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.

The functions in an .fll file remain available until you quit Visual FoxPro, so you only need to register them once per session. If you don't intend to call the functions in a .fll file again, issue RELEASE LIBRARY, RELEASE ALL, or SET LIBRARY TO to remove it from memory and free resources.

See Also

Accessing Dynamic-Link Libraries | Accessing ActiveX Controls and Objects | Access to External Libraries | Extending Visual FoxPro with External Libraries | Accessing the Visual FoxPro API