HPlogo HP-UX/HP C Compiler: HP C/HP-UX Reference Manual

Chapter 11 Using Intrinsics

» 

Technical documentation

Complete book in PDF

 » Table of Contents

An intrinsic is an external routine that can be called by HP C or any language that the HP-UX operating system supports. The intrinsic can be written in any supported language. However, its formal parameters must be of data types that have counterparts in HP C. This chapter describes the use of intrinsic functions in HP C programs.

Intrinsics are used much like library functions, except that users may write their own intrinsic routines, and then create an INTRINSIC_FILE. This file contains information about the number and type of parameters of the intrinsic. It is similar to a C header file. Additionally, the information in the INTRINSIC_FILE is accessible by other compilers, such as Pascal or Fortran. This will allow a single interface for multiple languages.

The body of an intrinsic routine is put into a library that contains the bodies of other intrinsics. Then, the declarations are put into an INTRINSIC_FILE. When calling an intrinsic from a program, #pragma INTRINSIC is used to specify the name of the intrinsic routine, and #pragma INTRINSIC_FILE is used to specify the location of the declaration of the intrinsic routine. Since the body of the intrinsic routine actually resides in a user-built library, that library must be linked in explicitly.

© Hewlett-Packard Development Company, L.P.