HP C A.06.05 Reference Manual

Compiling and Running HP C Programs
Pragmas
Chapter 9 227
FINI Pragma
#pragma FINI “
string
Use the compiler pragma FINI to specify a termination function. The function specified by the
FINI pragma is called after the C program terminates by either calling the libc exit()
function, returning from the main or _start functions, or when the shared library which
contains the FINI is unloaded from memory. Like the function called by the INIT pragma, the
termination function takes no arguments and returns nothing.
For example:
# pragma FINI “my-fini”
void my_fini() {
...do some clean up ...
}
Copyright Notice and Identification Pragmas
The following pragmas can be used to insert strings in code.
COPYRIGHT Pragma
#pragma COPYRIGHT "
string
"
Places a copyright notice in the object file, using the
string
argument and the date specified
using COPYRIGHT_DATE. If no date has been specified using #pragma COPYRIGHT_DATE, the
current year is used. For example, assuming the year is 2004, the directive #pragma
COPYRIGHT "Acme Software" places the following string in the object code:
(C) Copyright Acme Software, 2004. All rights reserved. No part
of this program may be photocopied, reproduced, or transmitted
without prior written consent of Acme Software.
COPYRIGHT_DATE Pragma
#pragma COPYRIGHT_DATE "
string
"
Specifies a date string to be used in a copyright notice appearing in an object module.
LOCALITY Pragma
#pragma LOCALITY "
string
"
Specifies a name to be associated with the code written to a relocatable object module. All code
following the LOCALITY pragma is associated with the name specified in
string.
The smallest
scope of a unique LOCALITY pragma is a function.