Share via


FoxInfo Structure

The FoxInfo structure is used to communicate function names and parameter descriptions between Visual FoxPro and your FLL library.

The following code illustrates the syntax for a FoxInfo structure:

FoxInfo arrayname[ ] = {
   {funcName1, FPFI function1, parmCount1, parmTypes1}
   {funcName2, FPFI function2, parmCount2, parmTypes2}
      . . .
   {funcNameN, FPFI functionN, parmCountN, parmTypesN}
};

The following table describes the parameters in this structure.

Parameter

Description

arrayname

Specifies a variable of type FoxInfo.

Note

You can include several FoxInfo structure lines in this array.

funcName

Contains the name that the Visual FoxPro user calls to invoke your function.

function

Specifies the address of your C language routine. This is the exact (case-sensitive) name you use to define your function.

parmCount

Specifies the number of parameters described in the parmTypes string or one of the following flag values. The following list describes possible flag values:

  • INTERNAL

    Specifies that the function cannot be called directly from Visual FoxPro.

  • CALLONLOAD

    Specifies that the routine is to be called when the library is loaded. CALLONLOAD can't call any routine that returns results to Visual FoxPro.

  • CALLONUNLOAD

    Specifies that the routine is to be called when the library is unloaded or when the Visual FoxPro QUIT command is issued. CALLONUNLOAD cannot call any routine that returns results to Visual FoxPro.

parmTypes

Describes the data type of each parameter.

The following lists the valid values for parmTypes.

  • " "

    No parameter.

  • "?"

    Specifies that any type can be passed. In the body of the function, you'll need to check the type of the passed parameter.

  • "C"

    Specifies a Character type parameter.

  • "D"

    Specifies a Date type parameter.

  • "I"

    Specifies an Integer type parameter.

  • "L"

    Specifies a Logical type parameter.

  • "N"

    Specifies a Numeric type parameter.

  • "R"

    Reference.

  • "T"

    Specifies a DateTime type parameter.

  • "Y"

    Specifies a Currency type parameter

  • "O"

    Specifies an Object type parameter

Note

Include a type value for each parameter passed to the library. To indicate that a parameter is optional, precede it with a period (.). Only trailing parameters can be omitted.

For example, suppose you create a function that accepts a character and a numeric parameter. When you specify parmType, use "CN".

The following example FoxInfo structure defines a library with one function, which is internally named dates and externally accessed as DATES. The structure accepts one Character type parameter:

FoxInfo myFoxInfo[] = {
   { "DATES", (FPFI) dates, 1, "C" }
};

After you compile your FLL library with this FoxInfo structure and load it in Visual FoxPro using the SET LIBRARY command, you can call this function in Visual FoxPro with the following line of code:

=DATES("01/01/95")

See Also

Tasks

How to: Add Visual FoxPro API Calls

Concepts

Creating Visual FoxPro Dynamic-Link Libraries

Other Resources

API Library Construction

Accessing the Visual FoxPro API