Compiling and binding in one step using compiler invocation command names supported by c89 and xlc
To compile and bind a XL C/C++ application program in one step to produce an executable file, specify c89 or c++ without specifying the -c option. You can use the -o option with the command to specify the name and location of the application program executable file that will be created. The c++ and cxx commands are identical. You can use cxx instead of c++ in all the examples that are shown in this topic. If you are using the xlc utility, you can also use the xlc and xlc++ commands, which are identical to c++ and cxx.
The c89 utility and xlc utility invoke the binder by default, unless the output file of the link-editing phase (-o option) is a PDS, in which case the prelinker is used.
- To compile and bind an application source file to create the 32-bit default
executable file a.out in the z/OS® UNIX System
Services working directory, specify:
c89 usersource.c c++ usersource.C
- To compile and bind an application source file to create the 64-bit
default executable file a.out in the z/OS UNIX working
directory, specify:
c89 -Wc,lp64 -Wl,lp64 usersource.c c++ -Wc,lp64 -Wl,lp64 usersource.C xlC_64 usersource.C
- To compile and bind an application source file to create the mymod.out executable
file in your /app/bin directory, specify:
c89 -o /app/bin/mymod.out usersource.c c++ -o /app/bin/mymod.out usersource.C
- To compile and bind several application source files to create
the mymod.out executable file in your /app/bin directory,
specify:
c89 -o /app/bin/mymod.out usrsrc.c otsrc.c "//'MUSR.C(PWAPP)'" c++ -o /app/bin/mymod.out usrsrc.C otsrc.C "//'MUSR.C(PWAPP)'"
- To compile and bind an application source file to create the MYLOADMD member
of your APPROG.LIB PDS, specify:
c89 -o "//'APPROG.LIB(MYLOADMD)'" usersource.c c++ -o "//'APPROG.LIB(MYLOADMD)'" usersource.C
- To compile and bind an application source file with several
previously compiled object files to create the executable file zinfo in
your /prg/lib z/OS UNIX directory, specify:
c89 -o /prg/lib/zinfo usrsrc.c xstobj.o "//'MUSR.OBJ(PWAPP)'" c++ -o /prg/lib/zinfo usrsrc.C xstobj.o "//'MUSR.OBJ(PWAPP)'"
- To compile and bind an application source file and capture
the listings from the compile and bind steps into another file,
specify:
c89 -V barryl.c > barryl.lst c++ -V barryl.C > barryl.lst
Note: -V does not cause all listings to be emitted when
you invoke the compiler using xlc. Use, for example, -qsource or -qlist instead.