To simplify the process of calling an ACUCOBOL-GT program from other programming languages in a Windows environment, the ACUCOBOL-GT 32-bit Windows runtime is encapsulated in a DLL file. This DLL file has been further encapsulated in a COM server.
To call ACUCOBOL-GT from other Windows programs, you can do one of two things:
The advantage of using the COM server is that you can treat the ACUCOBOL-GT system as a COM object. You do not need to insert declarations into the source code of the other programming language, you can operate in a multi-threaded environment, and the development environment is more intuitive. Using the ACUCOBOL-GT runtime DLL instead of the COM server can provide slightly improved performance and makes application distribution smaller and installation easier. However, the DLL can be called only from a single thread of execution. For example, if you call a COBOL program from a user interface control's event procedure, and the event procedure is called again before the COBOL program returns, you must detect this case and either wait or inform the user of the error.
Regardless of which approach you choose, when a program written in another language calls an ACUCOBOL-GT program, the data is passed as a pointer to a variant type for each parameter. The ACUCOBOL-GT program receives a handle for each parameter and uses a library routine to convert the data to COBOL types. When ACUCOBOL-GT data items are passed back to this program, they pass through another library routine that converts the data back into variant types. The C$GETVARIANT and C$SETVARIANT library routines are detailed in Library Routines.
The parameters of the COM server methods, or exported DLL functions, are all null-terminated strings, integers, or variant type variables. In some programming languages, such as Visual Basic (VB), the variant type is used by default for any variables that have not been assigned a data type. Because the variant type is used to represent many different types of data, you generally don't have to convert these types of data when they are assigned to a variant variable. The programming language automatically performs any necessary conversion. Because the ACUCOBOL-GT COM server and runtime DLL routines take variant type parameters, it is easy to receive variables from, or return variables to, other languages.