CitectVBA Programming Reference > Understanding CitectVBA Language Basics > DLLs and APIs > Declare statement structure
Declare statement structure

The Declare statement consists of the required Declare keyword, followed by the required Function statement, the required Lib statement, the optional Alias statement, the optional Argument statement(s) contained within braces, and the optional return data type statement.

Note: The use of the OPTIONAL components of the Declare statement syntax indicates that they may not be required in all DLL functions. It is not up to you whether you can optionally use them or not. If included in a DLL function, they MUST be used when declaring that function to CitectVBA.

The Declare statement in CitectVBA details the name, file location, arguments, intrinsic constants, and type definitions that the DLL function requires. Here's an example of the Declare statement for the Windows API GetTempPathA function, which returns the path to the Windows system temporary folder:

Declare Function GetTempPathA Lib "kernel32" _
(Byval nBufferLength As Long, _
Byval lpBuffer As String) As Long

The Declare keyword indicates to CitectVBA that you intend to call a function belonging to an external DLL. The Declare keyword must be used first in the declaration statement.