In order to simplify the process of calling an ACUCOBOL-GT program from other programming languages, the ACUCOBOL-GT 32-bit Windows runtime is encapsulated in a dynamic linked library (DLL) file. This DLL file has been further encapsulated in an Object Linking and Embedding (OLE) Automation Server.
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. These library routines, C$GETVARIANT and C$SETVARIANT, are detailed in Appendix I, ACUCOBOL-GT Library Routines.
There are two methods of calling the runtime:
1. Using the runtime DLL in an OLE Automation Server, or
2. Using the runtime DLL directly, with special declarations added to the source program.
The advantage of using the Automation Server is that you can treat the ACUCOBOL-GT system as an OLE 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 Automation Server, provides 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.
The parameters of the Automation methods, or exported DLL functions, are all null-terminated strings, integers or Variant type variables. In some programming languages, such as Visual Basic, the Variant type is used by default for any variables that have not been assigned a data type. Since 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 Automation Server and Runtime DLL routines take Variant type parameters, it easy to receive variables from, or return variables to, other languages.