--netdll

Restriction: This option requires the .NET Framework 4.0 for later SDK version.

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.

Compiling a COBOL program using the --netdll option requires the following Microsoft files: ILASM.exe and Al.exe. These files are supplied with .NET Framework SDK 2.0 and should be located using the --NETToolsDir compiler option; see .NET Development Options for more information.

Compilation creates three files, all of which 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. Programmers of .NET 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, and allows 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, which follow all the COBOL USING parameters for the entry name or Procedure Division statement:

Both --netdll and --netexe compiler options accept .NET version-specific modifiers to create .NET version-specific files.

Note: All of the criteria that apply to the CVM class also applies to the .NET component: see CVM Class for details.