--netdll

The --netdll compiler option generates a .NET dynamic link library (DLL) that gives .NET both executables and DLL assemblies a programmatic interface to your COBOL program. All COBOL entry points are exposed as .NET methods along with ACUCOBOL-GT run-time properties and methods. This lets .NET programmers set ACUCOBOL-GT command options and call run-time interfaces from their .NET assembly.

By referring to an ACUCOBOL-GT .NET DLL in a project solution, .NET programmers can view ACUCOBOL-GT run-time properties, run-time initialization and control methods, COBOL entry points, the main COBOL entry point, and Linkage section parameters in the Visual Studio .NET object browser.

Compilng a COBOL program using the --netdll option creates three files. All three begin with the program file name. For example, the compiler command:

ccbl32 --netdll MyProgram.cbl

results in MyProgram.dll, MyProgram.netmodule, and MyProgram_CVM.dll. .NET programmers would reference MyProgram.dll and MyProgram_CVM.dll in their project.

MyProgram_CVM.dll contains all the COBOL program entry points and ACUCOBOL-GT run-time interfaces exposed as .NET methods. ACUCOBOL-GT run-time options are exposed as properties.

The class in MyProgram.dll derives from class CVM which resides in MyProgram_CVM.dll allowing the instantiation of namespace class MyProgram.MyProgram myPgm = new MyProgram.MyProgram(). All methods and properties in MyProgram_CVM.dll class CVM are exposed to object myPgm.

MyProgram.netmodule contains ACUCOBOL-GT setup routines that are automatically executed during object instantiation. MyProgram.dll works in conjunction with MyProgram.netmodule to perform this task. The namespace and class are always generated using the COBOL file name without the extension. In this case the namespace and class are MyProgram.MyProgram.

As mentioned previously, COBOL entry names and the main COBOL program entry point generate .NET methods. Method parameters are generated when entry statements contain USING parameters or a Procedure Division statement contains USING parameters. There are two additional parameters added to each generated .NET method. They follow all the COBOL USING parameters for the entry name or Procedure Division statement. The first parameter, string, is for program execution command parameters. They are -d (debug) and -cache. All other run-time command options must be set via properties before calling AcuInitialize or in the string parameter of AcuInitialize.

The second parameter is for a return code. This is the return code from the COBOL program. The method return code is from the COBOL Virtual Machine interface and is documented in CVM Class. You can also view the values using the Visual Studio .NET object browser under ErrorTypes in class CVM.

The --netexe compiler option also accepts the following .NET version-specific modifiers to create .NET version-specific files:
  • :2.0
  • :3.0
  • :3.5
  • :4.0
Note:

All of the criteria that apply to the CVM class also apply to the .NET component. See CVM Class for details on these criteria.