Examples of Compiling and Linking From the Command Line

Use the cbllink command to link .obj files, or to compile and link source code files in one step.

To produce a system executable file

To compile and link the file myprog.cbl to produce an .exe file, myprog.exe, use the command:

cbllink myprog.cbl
To produce a dynamic link library file

To compile and link the file mydll.cbl to produce a .dll file, mydll.dll, use the command:

cbllink -d mydll.cbl
Creating a Standalone Executable File

The following command compiles and statically links the files main.cbl, module1.cbl, module2.cbl and any run-time support modules that are needed to create the graphical standalone executable main.exe:

cbllink -g -b main.cbl module1.cbl module2.cbl

The following command compiles and statically links the files main.cbl, module1.cbl, and any run-time support modules that are needed to create the character-based standalone executable myapp.exe:

cbllink -b -omyapp.exe main.cbl module1.cbl
Creating a Modular Application

The following examples show how to create an application in which the programs that execute the logic of your application are statically linked together, but the run-time support modules are dynamically linked.

The command:

cbllink -g -s main.cbl unique1.cbl

Compiles and statically links the files main.cbl and unique1.cbl to create the root module of the graphical application main.exe.

cbllink -d mffh

Links the run-time support module Mffh to create a dynamic link library, mffh.dll.

The following commands:

cbllink -s -omyapp.exe main.cbl unique1.cbl
cbllink -d adis adisinit adiskey

The following examples show how to create an application in which some prorams are statically linked together, others are dynamically linked, and the run-time support modules are dynamically linked.

To create an application in which:

Use the commands:

cbllink -g -s main.cbl fast1.cbl
cbllink -d -g -s -osubprogs.dll subprog2.cbl subprog3.cbl
cbllink -d mffh

To create an application in which:

cbllink -s -omyapp.exe main.cbl fast1.cbl
cbllink -d -s -osubprogs.dll subprog2.cbl+subprog3.cbl
cbllink -d adis adisinit adiskey
Creating dynamically bound applications