⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vms-misc.html

📁 gcc手册
💻 HTML
字号:
<html lang="en">

<head>

<title>Using the GNU Compiler Collection (GCC)</title>

<meta http-equiv="Content-Type" content="text/html">

<meta name="description" content="Using the GNU Compiler Collection (GCC)">

<meta name="generator" content="makeinfo 4.3">

<link href="http://www.gnu.org/software/texinfo/" rel="generator-home">

<!--

Copyright &copy; 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,

1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.



   <p>Permission is granted to copy, distribute and/or modify this document

under the terms of the GNU Free Documentation License, Version 1.2 or

any later version published by the Free Software Foundation; with the

Invariant Sections being "GNU General Public License" and "Funding

Free Software", the Front-Cover texts being (a) (see below), and with

the Back-Cover Texts being (b) (see below).  A copy of the license is

included in the section entitled "GNU Free Documentation License".



   <p>(a) The FSF's Front-Cover Text is:



   <p>A GNU Manual



   <p>(b) The FSF's Back-Cover Text is:



   <p>You have freedom to copy and modify this GNU Manual, like GNU

     software.  Copies published by the Free Software Foundation raise

     funds for GNU development.-->

</head>

<body>

<div class="node">

<p>

Node:<a name="VMS%20Misc">VMS Misc</a>,

Previous:<a rel="previous" accesskey="p" href="Global-Declarations.html#Global%20Declarations">Global Declarations</a>,

Up:<a rel="up" accesskey="u" href="VMS.html#VMS">VMS</a>

<hr><br>

</div>



<h3 class="section">Other VMS Issues</h3>



   <p>GCC automatically arranges for <code>main</code> to return 1 by default if

you fail to specify an explicit return value.  This will be interpreted

by VMS as a status code indicating a normal successful completion. 

Version 1 of GCC did not provide this default.



   <p>GCC on VMS works only with the GNU assembler, GAS.  You need version

1.37 or later of GAS in order to produce value debugging information for

the VMS debugger.  Use the ordinary VMS linker with the object files

produced by GAS.



   <p>Under previous versions of GCC, the generated code would occasionally

give strange results when linked to the sharable <code>VAXCRTL</code> library. 

Now this should work.



   <p>A caveat for use of <code>const</code> global variables: the <code>const</code>

modifier must be specified in every external declaration of the variable

in all of the source files that use that variable.  Otherwise the linker

will issue warnings about conflicting attributes for the variable.  Your

program will still work despite the warnings, but the variable will be

placed in writable storage.



   <p>Although the VMS linker does distinguish between upper and lower case

letters in global symbols, most VMS compilers convert all such symbols

into upper case and most run-time library routines also have upper case

names.  To be able to reliably call such routines, GCC (by means of

the assembler GAS) converts global symbols into upper case like other

VMS compilers.  However, since the usual practice in C is to distinguish

case, GCC (via GAS) tries to preserve usual C behavior by augmenting

each name that is not all lower case.  This means truncating the name

to at most 23 characters and then adding more characters at the end

which encode the case pattern of those 23.   Names which contain at

least one dollar sign are an exception; they are converted directly into

upper case without augmentation.



   <p>Name augmentation yields bad results for programs that use precompiled

libraries (such as Xlib) which were generated by another compiler.  You

can use the compiler option <code>/NOCASE_HACK</code> to inhibit augmentation;

it makes external C functions and variables case-independent as is usual

on VMS.  Alternatively, you could write all references to the functions

and variables in such libraries using lower case; this will work on VMS,

but is not portable to other systems.  The compiler option <code>/NAMES</code>

also provides control over global name handling.



   <p>Function and variable names are handled somewhat differently with G++. 

The GNU C++ compiler performs <dfn>name mangling</dfn> on function

names, which means that it adds information to the function name to

describe the data types of the arguments that the function takes.  One

result of this is that the name of a function can become very long. 

Since the VMS linker only recognizes the first 31 characters in a name,

special action is taken to ensure that each function and variable has a

unique name that can be represented in 31 characters.



   <p>If the name (plus a name augmentation, if required) is less than 32

characters in length, then no special action is performed.  If the name

is longer than 31 characters, the assembler (GAS) will generate a

hash string based upon the function name, truncate the function name to

23 characters, and append the hash string to the truncated name.  If the

<code>/VERBOSE</code> compiler option is used, the assembler will print both

the full and truncated names of each symbol that is truncated.



   <p>The <code>/NOCASE_HACK</code> compiler option should not be used when you are

compiling programs that use libg++.  libg++ has several instances of

objects (i.e.  <code>Filebuf</code> and <code>filebuf</code>) which become

indistinguishable in a case-insensitive environment.  This leads to

cases where you need to inhibit augmentation selectively (if you were

using libg++ and Xlib in the same program, for example).  There is no

special feature for doing this, but you can get the result by defining a

macro for each mixed case symbol for which you wish to inhibit

augmentation.  The macro should expand into the lower case equivalent of

itself.  For example:



<pre class="example">     #define StuDlyCapS studlycaps

     </pre>



   <p>These macro definitions can be placed in a header file to minimize the

number of changes to your source code.



   </body></html>



⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -