II.5 Coding Geosupport API Calls
The languages discussed in this section are C/C++ and Visual Basic/VBA. In general, the discussion assumes that the defaults were chosen during installation of Geosupport Desktop Edition.
This section describes the source code statements that the user must code in C/C++ and Visual Basic/VBA application programs to call the DLL. Also described are the statements required to declare the DLL.
As discussed in Chapter II.4, typically, the DLL can be called either with one or with two calling parameters. The first parameter passes the address of Work Area 1 to the DLL. If the application program is making a two-work-area call, the second parameter passes the address of Work Area 2 to the DLL.
The programming statements to declare and call the DLL are shown below.
Declaring the DLL
In a C/C++ program, the DLL is declared by including the NYCgeo.h header file that is distributed with Geosupport Desktop Edition, as shown below:
#include "NYCgeo.h"
In a Visual Basic/VBA program, the DLL must be declared to have two calling parameters for two-work-area calls and also two calling parameters for one-work area calls. This will not affect the processing. Examples of declaring NYCgeo for a two-work-area call (function 1E) and a one-work-area call (function D) appear below:
Declare Sub wgF1E Lib "NYCgeo.dll" Alias "NYCgeo" (x As C_WA1, y As C_WA2_F1E)
Declare Sub wgFD Lib "NYCgeo.dll" Alias "NYCgeo" (x As C_WA1, Optional y = NOTHING)
Calling the DLL If ‘WA1’ and ‘WA2’ are the names that the user has given to the work areas within the application program source code, the statement calling the DLL would be coded as follows:
Language | One-Work-Area Call | Two-Work-Area Call |
---|---|---|
C/C++ | NYCgeo(&WA1); | NYCgeo(&WA1,&WA2); |
Visual Basic/VBA | wgFD wa1 | wgF1E wa1, wa2 |