Chapter Contents

Previous

Next
Porting UNIX Socket Applications to the SAS/C Environment

Function Names

UNIX operating systems support very long external names. The OS/390 and CMS linking and library utilities restrict external names to eight characters. The SAS/C Compiler and COOL utility can map long external names into eight-character names, making the external OS/390 and CMS restrictions invisible in most cases.

The SAS/C Library also supports the #pragma map statement, which directs the compiler to change an external name in the source to a different name in the object file. Thus, long names are shortened, and names that are not lexically valid in C language can be generated. The socket library header files change long socket function names by including #pragma map . For example, the <netdb.h> header file contains the following statement:

#pragma map (gethostbyname, "#GHBNM")

This statement changes the gethostbyname function to #GHBNM . The #pragma map statement enables you to use TCP/IP functions with long names in your source and does not require that you use the extended names option or the COOL utility.

#pragma map statements are already in the header files required for each function. You normally do not have to modify your source to accommodate long names.

If your program produces an unresolved external reference for a socket function containing a long name, first make sure that you have included the appropriate header files as listed in the description for each socket function in Socket Function Reference. The following header files are not always required by UNIX C compilers but are required by the SAS/C Compiler to resolve long names:

The functions in most programs ported from a UNIX operating system have long names. If a function in your program contains a long name, use the extname name compiler option and the COOL utility to compile and link your program. The effects of both the #pragma map statement and the extname option are not usually visible to the user. For information on the significance of these features during machine-level debugging, reading link-edit maps, and writing zaps, refer to Appendix 7, "Extended Names," in the SAS/C Compiler and Library User's Guide.


Chapter Contents

Previous

Next

Top of Page

Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.