Using the C/iX Compiler [ HP Motif/iX Programmer's Supplement ] MPE/iX 5.0 Documentation
HP Motif/iX Programmer's Supplement
Using the C/iX Compiler
This section provides information about using the C/iX compiler[REV BEG]
the C/iX libraries and the c89 interface to the C/iX compiler[REV END]
when developing your X client. Refer to the following manuals for
information about the C programming language on MPE/iX and the C/iX
compiler:
[REV BEG]
* HP Compiler Library/iX Reference Manual (32650-90029)
* HP C/iX Reference Manual (31506-90005)
* HP C Programmer's Guide (92434-90002)
Refer to the following manuals for information on the c89 interface to
the C/iX compiler:
* MPE/iX Shell and Utilities User's Guide (36431-90002)
* MPE/iX Shell and Utilities Reference Manual, Volume 1
(36431-90001)
Refer to the following manuals for information on developing POSIX
applications:
* MPE/iX Shell and Utilities Reference Manual, Volume 2
(36431-90003)
* MPE/iX Developer's Kit Reference Manual, Volume 1 (36430-90001)
* MPE/iX Developer's Kit Reference Manual, Volume 2 (36430-90002)
* The POSIX.1 Standard: A Programmer's Guide (35430-90003) by Fred
Zlotnick, Benjamin/Cummings Publishing Company, Inc., 1991.
[REV END]
Programming for portability
This supplement recommends that you program for portability when
possible. The programming methods described below allow you to increase
the portability of your source code between MPE/iX and HP-UX.
Use the -I option. [REV BEG]
The header files for HP Motif/iX are located in the same hierarchical
directory path as they are on HP-UX. Thus, you must specify -I options to
direct the compiler for searching in the paths shown below:
* For the Motif header files, the path is /usr/include/Motif1.1
* For the Xt header files, the path is /usr/include/X11R4
* For the X11 header files, the path is /usr/include/X11R4
[REV END][REV BEG]
MPE/iX now has a generic interface to the C compiler and linker. It is
called c89. The c89 interface accepts source code conforming to the C
standard. When you use the c89 interface to the C/iX compiler for
linking your application, the POSIX/iX C library is automatically linked
with your application as a relocatable library. The syntax for using the
c89 interface to the C/iX compiler is similar to the syntax used on
HP-UX. The following example compiles and links the example program
PIZZA:
$c89 -c -I /usr/include/Motif1.1 -I /usr/include/X11R4
-D_POSIX_SOURCE -D_SOCKET_SOURCE _posix pizza.c
$c89 -L/usr/lib/Motif1.1 -L/usr/lib/X11R4 -L/usr/lib/X11R4
-o PIZZA pizza.o -lXm -lXt -lX11
The first line above compiles the PIZZA application from pizza.c into an
object file pizza.o. During this compilation process, it searches the
directories /usr/include/Motif1.1 and /usr/include/X11R4 for the Motif
and X header files. This line also defines the names _POSIX_SOURCE,
_SOCKET_SOURCE, and __posix to the preprocessing phase of the
compilation. These defines are required for compiling all HP Motif/iX
applications.
The second line in the above example links the PIZZA application to the
Motif, Xt, and X11 libraries as well as the POSIX/iX C library.
For more information on the c89 interface to the C/iX compiler, see
MPE/iX Shell and Utilities Reference Manual, Volume 1 (36431-90001).[REV
END]
C/iX Library Requirements
[REV BEG]
The C/iX library /lib/libC.a is required by the HP Motif/iX libraries.
This library is automatically linked into your application if you are
using the c89 interface to link your HP Motif/iX application.[REV END]
MPE/iX 5.0 Documentation