FuncFib

Applies to: Excel 2013 | Office 2013 | Visual Studio

Example user-defined worksheet function that computes the Nth Fibonacci number. When GENERIC.xll is loaded, it registers this function so that it can be called from the worksheet.

LPXLOPER12 WINAPI FuncFib (LPXLOPER12 pxN);

Parameters

pxN (LPXLOPER12)

The value of N for which the Nth Fibonacci number is required.

Property value/Return value

(xltypeNum LPXLOPER12 if successful or xltypeErr otherwise)

The Nth Fibonacci number.

Remarks

The function uses a static variable defined within the function block as the return value XLOPER12. This is not thread safe, and so this function, and any worksheet function that uses this strategy for returning XLOPERs or XLOPER12s, should not be registered as thread safe starting in Excel 2007.

Example

See \SAMPLES\GENERIC\GENERIC.C for the source code for this function.

See also

Functions in the Generic DLL