9 — Compiling and Linking Applications

[Previous] [Next] [Contents] [Index]

9.1 Overview of the Command Format

This chapter describes the command format for compiling and linking DCE applications on Tru64 UNIX systems.

Note that you can use either the cc compiler or the c89 compiler.

Every module of a DCE application program begins with the included header file pthread.h, as shown in the following example:

#include <pthread.h>

If pthread.h is not first in the include list for each module, the compiler can generate warning or error messages about the prototypes for these routines. In particular, it is best to precede those files containing call declarations for which there are jacket routines (such as stdio.h).

When linking a DCE application, you must use the -threads option.

Tru64 UNIX Version 4.0x supports the updated pthread standard, POSIX 1003.1c (D10), in addition to a backward-compatibility mode for the previous draft POSIX 1003.4a (D4).

DCE is built using the POSIX 1003.4a interfaces and the DCE documentation on pthreads corresponds to the 1003.4a standard. Until all DCE vendors support the new standard, we recommend that you continue to build your applications using POSIX 1003.4a interfaces.

To use interfaces defined in POSIX 1003.4a, compile all modules using -DPTRHEAD_USE_D4 and link the application using the -threads option in the loader.

The following command format is an example of how to compile and link:

% cc -o myprog myprog.c -DPTHREAD_USE_D4 -threads

For more information on pthreads for Tru64 UNIX refer to the Guide to DECthreads and to the reference pages on the ld command.

Note that the cc and c89 compilers do not define __STDC__ by default. If you want to include ANSI C function prototypes in your application, you must specify the -std1 option on the C compiler command line.

For complete information on compiling and linking applications, refer to the OSF DCE Application Development Guide.

[Previous] [Next] [Contents] [Index]

To make comments or ask for help, contact support@entegrity.com.

Copyright © 2001 Entegrity Solutions Corporation & its subsidiaries.

Copyright © 1998-2001 Compaq Computer Corporation.

All rights reserved.