Initializing the Visual Basic API

A program must initialize the API by calling the EsbInit() function before calling any other Essbase API functions. EsbInit() initializes all internal API state variables, and also allows you to tailor the API to your program's requirements.

The only function you can call before EsbInit() is EsbGetAPIVersion().

The calling program must pass the EsbInit() function an initialization structure. This structure is defined in ESB32.BAS as ESB_INIT_T. It contains a series of fields which are used to customize the API and set up certain API defaults. You must declare an instance of this structure and initialize the relevant fields before calling EsbInit().

The EsbInit() function returns an instance handle, which should then be passed as an argument to the API login function.

Declaring the Visual Basic Initialization Structure

In Visual Basic, you can declare the initialization structure in the procedure that uses it. The structure shown below is taken from ESB32.BAS.

Type ESB_INIT_T
   Version     As Long                  ' version of API
   MaxHandles  As Integer               ' maximum number of context handles required
   LocalPath   As String * ESB_PATHLEN  ' local path to use for file operations
   MessageFile As String * ESB_PATHLEN  ' full path name of message database file
   HelpFile    As String * ESB_PATHLEN  ' full path name of help file
   ClientError As Integer               ' allows use of a pseudo client error handler
   ErrorStack  As Integer               ' size of the error message stack
End Type

In this code, the fields are defined as follows: