Linking
C/C++ for Open Enterprise Languages on z/OS® 2.0 uses
the ld utility to invoke the binder, which links specified object files to create
one executable file. You can use the -Wl,<arg>,<arg2>... option to pass the
comma separated arguments to the ld utility. For example:
- -Wl,-v produces pseudo JCL that lists all inputs and options to the ld utility.
- -Wl,-V produces all binder listings that are essential for diagnosing link errors.
Unless you specify -c or -E, the last step of the compilation command is to perform the link step.
- Input files
- Object files, unstripped executable files, and library files serve as input to the binder.
Object files must have a
.osuffix, for example,filename.o. Static library file names have a.asuffix, for example,filename.a. DLL definition side file names have a.xsuffix, for example,filename.x. - Output files
- The binder generates an executable file by default and places it in your current
directory. The default name for an executable file is
a.out. To name the executable file explicitly, use the -o file_name option with the invocation command, wherefile_nameis the name you want to give to the executable file. For example, to compilemyfile.cand generate an executable file calledmyfile, enter:clang++ myfile.c -o myfileThe binder can also generate a shared library. If you use the option --shared, the binder generates a shared library and a side deck file. The default name for the shared library is alsoa.outand the default name for the side deck file is the name of the shared library with the suffix changed to.x, which isa.x. You can use the -o <file_name> option to name the shared library explicitly. For example,if you specify -o libabc.so, then the side deck file name islibabc.x. You can use the following command to compilemyfile.cand generate a shared library with the name oflibmyfile.so:clang++ --shared -o libmyfile.so
Related information
- ld command in the z/OS UNIX System Services Command Reference