/usr/share/doc/libcnf-dev/html/node17.html is in libcnf-dev 4.0-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<!--Converted with LaTeX2HTML 98.2 beta6 (August 14th, 1998)
original version by: Nikos Drakos, CBLU, University of Leeds
* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan
* with significant contributions from:
Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
<HTML>
<HEAD>
<TITLE>Global Data</TITLE>
<META NAME="description" CONTENT="Global Data">
<META NAME="keywords" CONTENT="sun209">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<LINK REL="STYLESHEET" HREF="sun209.css">
<LINK REL="previous" HREF="node16.html">
<LINK REL="up" HREF="node14.html">
<LINK REL="next" HREF="node18.html">
</HEAD>
<BODY >
<BR> <HR>
<A NAME="tex2html376"
HREF="node18.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next_motif.gif"></A>
<A NAME="tex2html374"
HREF="node14.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up_motif.gif"></A>
<A NAME="tex2html370"
HREF="node16.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="previous_motif.gif"></A> <A HREF="sun209.html#stardoccontents"><IMG
ALIGN="BOTTOM" BORDER="0" SRC="contents_motif.gif"
ALT="252"></A>
<BR>
<B> Next:</B> <A NAME="tex2html377"
HREF="node18.html">More on Calling C from FORTRAN</A>
<BR>
<B>Up:</B> <A NAME="tex2html375"
HREF="node14.html">Communication Between Routines</A>
<BR>
<B> Previous:</B> <A NAME="tex2html371"
HREF="node16.html">Function Values</A>
<BR> <HR> <P>
<!--End of Navigation Panel-->
<H2><A NAME="SECTION00053000000000000000"></A><A NAME="xref_global_data"></A>
<BR>
Global Data
</H2>
<P>
Different languages can have very different ways of dealing with variables that
are not local to a particular routine, but have a more global scope. FORTRAN
has common blocks for global data that are accessed by particular routines. The
data values in a common block can be accessed by different names in different
routines, although this is generally considered bad practice. C functions can
access global data by using variables that are not declared in a particular
routine, but have a scope of all the routines contained in the source file in
which the global variables are defined. If the same variable is needed across
several source files, then it can be declared as <TT>extern</TT>.
<P>
Although these two mechanisms are very different in principle, in practice,
computer manufacturers tend to implement them in a way such that it is possible
to share global data between routines that have been written in different
languages. The details of how this is done are given in the appendix about
specific machines. However, there is an indirect way of accessing FORTRAN
common blocks from C that is also worth considering. The FORTRAN routine that
calls the C function can pass as an argument, the first element of the common
block. As long as FORTRAN passes this argument by reference, then the C
function can use this address to access all of the other elements of the common
block. The elements of the common block must be stored contiguously. Whether
this method, or the use of the
<A HREF="node26.html#f77_common">F77 macros</A>,
achieve a greater degree of portability in this respect is not known at
present. On account of these potential portability problems, you should avoid
passing global data between routines written in different languages, whenever
possible.
<P>
<BR> <HR>
<A NAME="tex2html376"
HREF="node18.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next_motif.gif"></A>
<A NAME="tex2html374"
HREF="node14.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up_motif.gif"></A>
<A NAME="tex2html370"
HREF="node16.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="previous_motif.gif"></A> <A HREF="sun209.html#stardoccontents"><IMG
ALIGN="BOTTOM" BORDER="0" SRC="contents_motif.gif"
ALT="252"></A>
<BR>
<B> Next:</B> <A NAME="tex2html377"
HREF="node18.html">More on Calling C from FORTRAN</A>
<BR>
<B>Up:</B> <A NAME="tex2html375"
HREF="node14.html">Communication Between Routines</A>
<BR>
<B> Previous:</B> <A NAME="tex2html371"
HREF="node16.html">Function Values</A>
<BR> <HR> <P>
<!--End of Navigation Panel-->
<ADDRESS>
<I>CNF and F77 Mixed Language Programming -- FORTRAN and C<BR>Starlink User Note 209<BR>P.M. Allan<BR>A.J. Chipperfield<BR>R.F. Warren-Smith<BR>19 January 2000<BR>E-mail:<A HREF="mailto:ussc@star.rl.ac.uk">ussc@star.rl.ac.uk</A></I>
</ADDRESS>
</BODY>
</HTML>
|