HP 3000 Manuals

Building DCE Programs [ DCE for the HP 3000 ] MPE/iX 5.0 Documentation


DCE for the HP 3000

Building DCE Programs 

Header Files 

In addition to the standard POSIX libraries and HP C/XL functions, you
may have to include the DCE header files, which can be found in the
/usr/include/dce directory.  If your C applications use Try/Catch for
exception handling, you should include the following statement in the C
programs:

     #include <dce/pthread_exc.h>

There are no MPE/iX equivalent libraries for /usr/lib/libbb.a or
/usr/lib/libc_r.a.  The reentrant functions that are defined in MPE/iX
and the thread-safe wrapper functions are in /usr/lib/libdce.a.

MPE/iX does not have the file strings.h.  The HP-UX strings.h includes
string.h, sys/stdsyms.h and some definitions that are strictly for C++
and HP-UX.

Compiler Flags 

When compiling DCE applications using ANSI C under the MPE CI, set the
following compiler switches:

     -D_POSIX_SOURCE -D_MPEXL_SOURCE -D_SOCKET_SOURCE -D_REENTRANT -Aa

When compiling under the MPE POSIX shell, you need the above flags except
for the -Aa optoin.  If -Aa is set, /bin/c89 displays a large amount of
error messages (by definiton, the POSIX environment always uses the ANSI
C compiler).

Unresolved Externals 

When porting applications from a unix environment to MPE/iX, you may
receive unresolved external errors during a compile, link, or run phase.
It is likely that the unresolved externals are not part of the POSIX.1
standard.  To find out if a function is defined in the POSIX environment,
look at the manpage for that function on a UNIX system.  At the bottom of
the manpage, there is a section titled STANDARD CONFORMANCE, which lists
the function name and the standard it conforms to.  If the manpage does
not have POSIX.1 listed as one of the standards then that function is not
part of the MPE/iX Posix Environment.  To get around this porting issue,
you may have to write a routine to emulate the functionality for the
unresolved external.

MPE/iX Makefile Example 

The following is an MPE/iX makefile example.

     #
     # (c) Copyright 1992, 1993 Hewlett-Packard Co.
     #
     # @(#)HP DCE/3000 1.0.2
     # @(#)Module: Makefile $Revision:1.1.7.2 $
     # $Date:1993/07/08 00:06:21$
     # Makefile modified for use on an HP 3000.
     #

     DEBUG           =
     INCENV          = -I. -I/usr/include
     ANSI_FLAGS      = -D_POSIX_SOURCE
     HP_FLAGS        = -D_REENTRANT -D_MPEXL_SOURCE -D_SOCKET_SOURCE

     CFLAGS          = ${ANSI_FLAGS} ${DEBUG} ${HP_FLAGS} ${INCENV}
     LDFLAGS         =
     LIBS            = -ldce -lsocket -lsvipc -lm -lc

     PROGRAMS        = sleeper_server sleeper_client
     server_OFILES   = sleeper_sstub.o manager.o server.o
     client_OFILES   = sleeper_cstub.o client.o

     IDLFLAGS        = -keep c_source ${INCENV}
     IDLFILES        = sleeper.idl
     IDLGEN          = sleeper.h sleeper_*stub.c sleeper_*aux.c
     IDL             = /SYS/HPBIN/SH idl

     all:            objects ${PROGRAMS}
     objects:        ${server_OFILES} ${client_OFILES}
     fresh:          clean all

     clean:;
       rm -f ${server_OFILES} ${client_OFILES} ${PROGRAMS} ${IDLGEN}

     clobber:        clean
       rm -f a.out core ERRS make.out *~

     sleeper_server: ${server_OFILES}
       $(CC) ${LDFLAGS} ${server_OFILES} ${LIBS} -o $@
       mv -f sleeper_server /SYS/PUB/SLEEPSRV
       callci linkedit \"altprog sleepsrv.pub.sys\;xl='othdxl.threads.sys'\"
       mv -f /SYS/PUB/SLEEPSRV sleeper_srver

     sleeper_client: ${client_OFILES}
       $(CC) ${LDFLAGS} ${client_OFILES} ${LIBS} -o $@
       mv -f sleeper_client /SYS/PUB/SLEEPCLT
       callci linkedit \"altprog sleepclt.pub.sys\;xl='othdxl.threads.sys'\"
       mv -f /SYS/PUB/SLEEPCLT sleeper_client

     sleeper_cstub.c sleeper_sstub.c sleeper.h:      ${IDLFILES}
       $(IDL) ${IDLFLAGS} ${IDLFILES}

     sleeper_cstub.o sleeper_sstub.o manager.o server.o client.o: sleeper.h
     manager.o server.o client.o: common.h

HP-UX Makefile Example 

The following is an HP-UX makefile example.

     #
     # (c) Copyright 1992, 1993 Hewlett-Packard Co.
     #
     # @(#)HP DCE/9000 1.0.2
     # @(#)Module: Makefile $Revision: 1.1.7.2 $
     # $Date: 1993/07/08 00:06:21$
     # Makefile for use with an HP 9000.
     #

     DEBUG           = -g
     INCENV          = -I. -I/usr/include/reentrant
     ANSI_FLAGS      = -Aa -D_POSIX_SOURCE
     HP_FLAGS        = -D_REENTRANT -DTRACING

     CFLAGS          = ${ANSI_FLAGS} ${DEBUG} ${HP_FLAGS} ${INCENV}
     LDFLAGS         = ${DEBUG} -Wl, -a, archive
     LIBS            = -lbb -ldce -lm -lc_r

     PROGRAMS        = sleeper_server sleeper_client
     server_OFILES   = sleeper_sstub.o manager.o server.o
     client_OFILES   = sleeper_cstub.o client.o

     IDLFLAGS        = -keep c_source ${INCENV}
     IDLFILES        = sleeper.idl
     IDLGEN          = sleeper.h sleeper_*stub.c sleeper_*aux.c
     IDL             = idl

     all:            objects ${PROGRAMS}
     objects:        ${server_OFILES} ${client_OFILES}
     fresh:          clean all

     clean:;
       rm -f ${server_OFILES} ${client_OFILES} ${PROGRAMS} ${IDLGEN}

     clobber:        clean
       rm -f a.out core ERRS make.out *~

     sleeper_server: ${server_OFILES}
       $(CC) ${LDFLAGS} ${server_OFILES} ${LIBS} -o $@

     sleeper_client: ${client_OFILES}
       $(CC) ${LDFLAGS} ${client_OFILES} ${LIBS} -o $@

     sleeper_cstub.c sleeper_sstub.c sleeper.h:      ${IDLFILES}
       $(IDL) ${IDLFLAGS} ${IDLFILES}

     sleeper_cstub.o sleeper_sstub.o manager.o server.o client.o: sleeper.h
     manager.o server.o client.o: common.h



MPE/iX 5.0 Documentation