1 |
284 |
jeremybenn |
This is doc/gcj.info, produced by makeinfo version 4.12 from
|
2 |
|
|
/space/rguenther/gcc-4.5.1/gcc-4.5.1/gcc/java/gcj.texi.
|
3 |
|
|
|
4 |
|
|
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free
|
5 |
|
|
Software Foundation, Inc.
|
6 |
|
|
|
7 |
|
|
Permission is granted to copy, distribute and/or modify this document
|
8 |
|
|
under the terms of the GNU Free Documentation License, Version 1.2 or
|
9 |
|
|
any later version published by the Free Software Foundation; with no
|
10 |
|
|
Invariant Sections, the Front-Cover Texts being (a) (see below), and
|
11 |
|
|
with the Back-Cover Texts being (b) (see below). A copy of the license
|
12 |
|
|
is included in the section entitled "GNU Free Documentation License".
|
13 |
|
|
|
14 |
|
|
(a) The FSF's Front-Cover Text is:
|
15 |
|
|
|
16 |
|
|
A GNU Manual
|
17 |
|
|
|
18 |
|
|
(b) The FSF's Back-Cover Text is:
|
19 |
|
|
|
20 |
|
|
You have freedom to copy and modify this GNU Manual, like GNU
|
21 |
|
|
software. Copies published by the Free Software Foundation raise
|
22 |
|
|
funds for GNU development.
|
23 |
|
|
|
24 |
|
|
INFO-DIR-SECTION Software development
|
25 |
|
|
START-INFO-DIR-ENTRY
|
26 |
|
|
* Gcj: (gcj). Ahead-of-time compiler for the Java language
|
27 |
|
|
END-INFO-DIR-ENTRY
|
28 |
|
|
|
29 |
|
|
INFO-DIR-SECTION Individual utilities
|
30 |
|
|
START-INFO-DIR-ENTRY
|
31 |
|
|
* jcf-dump: (gcj)Invoking jcf-dump.
|
32 |
|
|
Print information about Java class files
|
33 |
|
|
* gij: (gcj)Invoking gij. GNU interpreter for Java bytecode
|
34 |
|
|
* gcj-dbtool: (gcj)Invoking gcj-dbtool.
|
35 |
|
|
Tool for manipulating class file databases.
|
36 |
|
|
* jv-convert: (gcj)Invoking jv-convert.
|
37 |
|
|
Convert file from one encoding to another
|
38 |
|
|
* grmic: (gcj)Invoking grmic.
|
39 |
|
|
Generate stubs for Remote Method Invocation.
|
40 |
|
|
* gc-analyze: (gcj)Invoking gc-analyze.
|
41 |
|
|
Analyze Garbage Collector (GC) memory dumps.
|
42 |
|
|
* aot-compile: (gcj)Invoking aot-compile.
|
43 |
|
|
Compile bytecode to native and generate databases.
|
44 |
|
|
* rebuild-gcj-db: (gcj)Invoking rebuild-gcj-db.
|
45 |
|
|
Merge the per-solib databases made by aot-compile
|
46 |
|
|
into one system-wide database.
|
47 |
|
|
END-INFO-DIR-ENTRY
|
48 |
|
|
|
49 |
|
|
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free
|
50 |
|
|
Software Foundation, Inc.
|
51 |
|
|
|
52 |
|
|
Permission is granted to copy, distribute and/or modify this document
|
53 |
|
|
under the terms of the GNU Free Documentation License, Version 1.2 or
|
54 |
|
|
any later version published by the Free Software Foundation; with no
|
55 |
|
|
Invariant Sections, the Front-Cover Texts being (a) (see below), and
|
56 |
|
|
with the Back-Cover Texts being (b) (see below). A copy of the license
|
57 |
|
|
is included in the section entitled "GNU Free Documentation License".
|
58 |
|
|
|
59 |
|
|
(a) The FSF's Front-Cover Text is:
|
60 |
|
|
|
61 |
|
|
A GNU Manual
|
62 |
|
|
|
63 |
|
|
(b) The FSF's Back-Cover Text is:
|
64 |
|
|
|
65 |
|
|
You have freedom to copy and modify this GNU Manual, like GNU
|
66 |
|
|
software. Copies published by the Free Software Foundation raise
|
67 |
|
|
funds for GNU development.
|
68 |
|
|
|
69 |
|
|
|
70 |
|
|
File: gcj.info, Node: Top, Next: Copying, Up: (dir)
|
71 |
|
|
|
72 |
|
|
Introduction
|
73 |
|
|
************
|
74 |
|
|
|
75 |
|
|
This manual describes how to use `gcj', the GNU compiler for the Java
|
76 |
|
|
programming language. `gcj' can generate both `.class' files and
|
77 |
|
|
object files, and it can read both Java source code and `.class' files.
|
78 |
|
|
|
79 |
|
|
* Menu:
|
80 |
|
|
|
81 |
|
|
* Copying:: The GNU General Public License
|
82 |
|
|
* GNU Free Documentation License::
|
83 |
|
|
How you can share and copy this manual
|
84 |
|
|
* Invoking gcj:: Compiler options supported by `gcj'
|
85 |
|
|
* Compatibility:: Compatibility between gcj and other tools for Java
|
86 |
|
|
* Invoking jcf-dump:: Print information about class files
|
87 |
|
|
* Invoking gij:: Interpreting Java bytecodes
|
88 |
|
|
* Invoking gcj-dbtool:: Tool for manipulating class file databases.
|
89 |
|
|
* Invoking jv-convert:: Converting from one encoding to another
|
90 |
|
|
* Invoking grmic:: Generate stubs for Remote Method Invocation.
|
91 |
|
|
* Invoking gc-analyze:: Analyze Garbage Collector (GC) memory dumps.
|
92 |
|
|
* Invoking aot-compile:: Compile bytecode to native and generate databases.
|
93 |
|
|
* Invoking rebuild-gcj-db:: Merge the per-solib databases made by aot-compile
|
94 |
|
|
into one system-wide database.
|
95 |
|
|
* About CNI:: Description of the Compiled Native Interface
|
96 |
|
|
* System properties:: Modifying runtime behavior of the libgcj library
|
97 |
|
|
* Resources:: Where to look for more information
|
98 |
|
|
* Index:: Index.
|
99 |
|
|
|
100 |
|
|
|
101 |
|
|
File: gcj.info, Node: Copying, Next: GNU Free Documentation License, Prev: Top, Up: Top
|
102 |
|
|
|
103 |
|
|
GNU General Public License
|
104 |
|
|
**************************
|
105 |
|
|
|
106 |
|
|
Version 3, 29 June 2007
|
107 |
|
|
|
108 |
|
|
Copyright (C) 2007 Free Software Foundation, Inc. `http://fsf.org/'
|
109 |
|
|
|
110 |
|
|
Everyone is permitted to copy and distribute verbatim copies of this
|
111 |
|
|
license document, but changing it is not allowed.
|
112 |
|
|
|
113 |
|
|
Preamble
|
114 |
|
|
========
|
115 |
|
|
|
116 |
|
|
The GNU General Public License is a free, copyleft license for software
|
117 |
|
|
and other kinds of works.
|
118 |
|
|
|
119 |
|
|
The licenses for most software and other practical works are designed
|
120 |
|
|
to take away your freedom to share and change the works. By contrast,
|
121 |
|
|
the GNU General Public License is intended to guarantee your freedom to
|
122 |
|
|
share and change all versions of a program-to make sure it remains free
|
123 |
|
|
software for all its users. We, the Free Software Foundation, use the
|
124 |
|
|
GNU General Public License for most of our software; it applies also to
|
125 |
|
|
any other work released this way by its authors. You can apply it to
|
126 |
|
|
your programs, too.
|
127 |
|
|
|
128 |
|
|
When we speak of free software, we are referring to freedom, not
|
129 |
|
|
price. Our General Public Licenses are designed to make sure that you
|
130 |
|
|
have the freedom to distribute copies of free software (and charge for
|
131 |
|
|
them if you wish), that you receive source code or can get it if you
|
132 |
|
|
want it, that you can change the software or use pieces of it in new
|
133 |
|
|
free programs, and that you know you can do these things.
|
134 |
|
|
|
135 |
|
|
To protect your rights, we need to prevent others from denying you
|
136 |
|
|
these rights or asking you to surrender the rights. Therefore, you
|
137 |
|
|
have certain responsibilities if you distribute copies of the software,
|
138 |
|
|
or if you modify it: responsibilities to respect the freedom of others.
|
139 |
|
|
|
140 |
|
|
For example, if you distribute copies of such a program, whether
|
141 |
|
|
gratis or for a fee, you must pass on to the recipients the same
|
142 |
|
|
freedoms that you received. You must make sure that they, too, receive
|
143 |
|
|
or can get the source code. And you must show them these terms so they
|
144 |
|
|
know their rights.
|
145 |
|
|
|
146 |
|
|
Developers that use the GNU GPL protect your rights with two steps:
|
147 |
|
|
(1) assert copyright on the software, and (2) offer you this License
|
148 |
|
|
giving you legal permission to copy, distribute and/or modify it.
|
149 |
|
|
|
150 |
|
|
For the developers' and authors' protection, the GPL clearly explains
|
151 |
|
|
that there is no warranty for this free software. For both users' and
|
152 |
|
|
authors' sake, the GPL requires that modified versions be marked as
|
153 |
|
|
changed, so that their problems will not be attributed erroneously to
|
154 |
|
|
authors of previous versions.
|
155 |
|
|
|
156 |
|
|
Some devices are designed to deny users access to install or run
|
157 |
|
|
modified versions of the software inside them, although the
|
158 |
|
|
manufacturer can do so. This is fundamentally incompatible with the
|
159 |
|
|
aim of protecting users' freedom to change the software. The
|
160 |
|
|
systematic pattern of such abuse occurs in the area of products for
|
161 |
|
|
individuals to use, which is precisely where it is most unacceptable.
|
162 |
|
|
Therefore, we have designed this version of the GPL to prohibit the
|
163 |
|
|
practice for those products. If such problems arise substantially in
|
164 |
|
|
other domains, we stand ready to extend this provision to those domains
|
165 |
|
|
in future versions of the GPL, as needed to protect the freedom of
|
166 |
|
|
users.
|
167 |
|
|
|
168 |
|
|
Finally, every program is threatened constantly by software patents.
|
169 |
|
|
States should not allow patents to restrict development and use of
|
170 |
|
|
software on general-purpose computers, but in those that do, we wish to
|
171 |
|
|
avoid the special danger that patents applied to a free program could
|
172 |
|
|
make it effectively proprietary. To prevent this, the GPL assures that
|
173 |
|
|
patents cannot be used to render the program non-free.
|
174 |
|
|
|
175 |
|
|
The precise terms and conditions for copying, distribution and
|
176 |
|
|
modification follow.
|
177 |
|
|
|
178 |
|
|
TERMS AND CONDITIONS
|
179 |
|
|
====================
|
180 |
|
|
|
181 |
|
|
0. Definitions.
|
182 |
|
|
|
183 |
|
|
"This License" refers to version 3 of the GNU General Public
|
184 |
|
|
License.
|
185 |
|
|
|
186 |
|
|
"Copyright" also means copyright-like laws that apply to other
|
187 |
|
|
kinds of works, such as semiconductor masks.
|
188 |
|
|
|
189 |
|
|
"The Program" refers to any copyrightable work licensed under this
|
190 |
|
|
License. Each licensee is addressed as "you". "Licensees" and
|
191 |
|
|
"recipients" may be individuals or organizations.
|
192 |
|
|
|
193 |
|
|
To "modify" a work means to copy from or adapt all or part of the
|
194 |
|
|
work in a fashion requiring copyright permission, other than the
|
195 |
|
|
making of an exact copy. The resulting work is called a "modified
|
196 |
|
|
version" of the earlier work or a work "based on" the earlier work.
|
197 |
|
|
|
198 |
|
|
A "covered work" means either the unmodified Program or a work
|
199 |
|
|
based on the Program.
|
200 |
|
|
|
201 |
|
|
To "propagate" a work means to do anything with it that, without
|
202 |
|
|
permission, would make you directly or secondarily liable for
|
203 |
|
|
infringement under applicable copyright law, except executing it
|
204 |
|
|
on a computer or modifying a private copy. Propagation includes
|
205 |
|
|
copying, distribution (with or without modification), making
|
206 |
|
|
available to the public, and in some countries other activities as
|
207 |
|
|
well.
|
208 |
|
|
|
209 |
|
|
To "convey" a work means any kind of propagation that enables other
|
210 |
|
|
parties to make or receive copies. Mere interaction with a user
|
211 |
|
|
through a computer network, with no transfer of a copy, is not
|
212 |
|
|
conveying.
|
213 |
|
|
|
214 |
|
|
An interactive user interface displays "Appropriate Legal Notices"
|
215 |
|
|
to the extent that it includes a convenient and prominently visible
|
216 |
|
|
feature that (1) displays an appropriate copyright notice, and (2)
|
217 |
|
|
tells the user that there is no warranty for the work (except to
|
218 |
|
|
the extent that warranties are provided), that licensees may
|
219 |
|
|
convey the work under this License, and how to view a copy of this
|
220 |
|
|
License. If the interface presents a list of user commands or
|
221 |
|
|
options, such as a menu, a prominent item in the list meets this
|
222 |
|
|
criterion.
|
223 |
|
|
|
224 |
|
|
1. Source Code.
|
225 |
|
|
|
226 |
|
|
The "source code" for a work means the preferred form of the work
|
227 |
|
|
for making modifications to it. "Object code" means any
|
228 |
|
|
non-source form of a work.
|
229 |
|
|
|
230 |
|
|
A "Standard Interface" means an interface that either is an
|
231 |
|
|
official standard defined by a recognized standards body, or, in
|
232 |
|
|
the case of interfaces specified for a particular programming
|
233 |
|
|
language, one that is widely used among developers working in that
|
234 |
|
|
language.
|
235 |
|
|
|
236 |
|
|
The "System Libraries" of an executable work include anything,
|
237 |
|
|
other than the work as a whole, that (a) is included in the normal
|
238 |
|
|
form of packaging a Major Component, but which is not part of that
|
239 |
|
|
Major Component, and (b) serves only to enable use of the work
|
240 |
|
|
with that Major Component, or to implement a Standard Interface
|
241 |
|
|
for which an implementation is available to the public in source
|
242 |
|
|
code form. A "Major Component", in this context, means a major
|
243 |
|
|
essential component (kernel, window system, and so on) of the
|
244 |
|
|
specific operating system (if any) on which the executable work
|
245 |
|
|
runs, or a compiler used to produce the work, or an object code
|
246 |
|
|
interpreter used to run it.
|
247 |
|
|
|
248 |
|
|
The "Corresponding Source" for a work in object code form means all
|
249 |
|
|
the source code needed to generate, install, and (for an executable
|
250 |
|
|
work) run the object code and to modify the work, including
|
251 |
|
|
scripts to control those activities. However, it does not include
|
252 |
|
|
the work's System Libraries, or general-purpose tools or generally
|
253 |
|
|
available free programs which are used unmodified in performing
|
254 |
|
|
those activities but which are not part of the work. For example,
|
255 |
|
|
Corresponding Source includes interface definition files
|
256 |
|
|
associated with source files for the work, and the source code for
|
257 |
|
|
shared libraries and dynamically linked subprograms that the work
|
258 |
|
|
is specifically designed to require, such as by intimate data
|
259 |
|
|
communication or control flow between those subprograms and other
|
260 |
|
|
parts of the work.
|
261 |
|
|
|
262 |
|
|
The Corresponding Source need not include anything that users can
|
263 |
|
|
regenerate automatically from other parts of the Corresponding
|
264 |
|
|
Source.
|
265 |
|
|
|
266 |
|
|
The Corresponding Source for a work in source code form is that
|
267 |
|
|
same work.
|
268 |
|
|
|
269 |
|
|
2. Basic Permissions.
|
270 |
|
|
|
271 |
|
|
All rights granted under this License are granted for the term of
|
272 |
|
|
copyright on the Program, and are irrevocable provided the stated
|
273 |
|
|
conditions are met. This License explicitly affirms your unlimited
|
274 |
|
|
permission to run the unmodified Program. The output from running
|
275 |
|
|
a covered work is covered by this License only if the output,
|
276 |
|
|
given its content, constitutes a covered work. This License
|
277 |
|
|
acknowledges your rights of fair use or other equivalent, as
|
278 |
|
|
provided by copyright law.
|
279 |
|
|
|
280 |
|
|
You may make, run and propagate covered works that you do not
|
281 |
|
|
convey, without conditions so long as your license otherwise
|
282 |
|
|
remains in force. You may convey covered works to others for the
|
283 |
|
|
sole purpose of having them make modifications exclusively for
|
284 |
|
|
you, or provide you with facilities for running those works,
|
285 |
|
|
provided that you comply with the terms of this License in
|
286 |
|
|
conveying all material for which you do not control copyright.
|
287 |
|
|
Those thus making or running the covered works for you must do so
|
288 |
|
|
exclusively on your behalf, under your direction and control, on
|
289 |
|
|
terms that prohibit them from making any copies of your
|
290 |
|
|
copyrighted material outside their relationship with you.
|
291 |
|
|
|
292 |
|
|
Conveying under any other circumstances is permitted solely under
|
293 |
|
|
the conditions stated below. Sublicensing is not allowed; section
|
294 |
|
|
10 makes it unnecessary.
|
295 |
|
|
|
296 |
|
|
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
297 |
|
|
|
298 |
|
|
No covered work shall be deemed part of an effective technological
|
299 |
|
|
measure under any applicable law fulfilling obligations under
|
300 |
|
|
article 11 of the WIPO copyright treaty adopted on 20 December
|
301 |
|
|
1996, or similar laws prohibiting or restricting circumvention of
|
302 |
|
|
such measures.
|
303 |
|
|
|
304 |
|
|
When you convey a covered work, you waive any legal power to forbid
|
305 |
|
|
circumvention of technological measures to the extent such
|
306 |
|
|
circumvention is effected by exercising rights under this License
|
307 |
|
|
with respect to the covered work, and you disclaim any intention
|
308 |
|
|
to limit operation or modification of the work as a means of
|
309 |
|
|
enforcing, against the work's users, your or third parties' legal
|
310 |
|
|
rights to forbid circumvention of technological measures.
|
311 |
|
|
|
312 |
|
|
4. Conveying Verbatim Copies.
|
313 |
|
|
|
314 |
|
|
You may convey verbatim copies of the Program's source code as you
|
315 |
|
|
receive it, in any medium, provided that you conspicuously and
|
316 |
|
|
appropriately publish on each copy an appropriate copyright notice;
|
317 |
|
|
keep intact all notices stating that this License and any
|
318 |
|
|
non-permissive terms added in accord with section 7 apply to the
|
319 |
|
|
code; keep intact all notices of the absence of any warranty; and
|
320 |
|
|
give all recipients a copy of this License along with the Program.
|
321 |
|
|
|
322 |
|
|
You may charge any price or no price for each copy that you convey,
|
323 |
|
|
and you may offer support or warranty protection for a fee.
|
324 |
|
|
|
325 |
|
|
5. Conveying Modified Source Versions.
|
326 |
|
|
|
327 |
|
|
You may convey a work based on the Program, or the modifications to
|
328 |
|
|
produce it from the Program, in the form of source code under the
|
329 |
|
|
terms of section 4, provided that you also meet all of these
|
330 |
|
|
conditions:
|
331 |
|
|
|
332 |
|
|
a. The work must carry prominent notices stating that you
|
333 |
|
|
modified it, and giving a relevant date.
|
334 |
|
|
|
335 |
|
|
b. The work must carry prominent notices stating that it is
|
336 |
|
|
released under this License and any conditions added under
|
337 |
|
|
section 7. This requirement modifies the requirement in
|
338 |
|
|
section 4 to "keep intact all notices".
|
339 |
|
|
|
340 |
|
|
c. You must license the entire work, as a whole, under this
|
341 |
|
|
License to anyone who comes into possession of a copy. This
|
342 |
|
|
License will therefore apply, along with any applicable
|
343 |
|
|
section 7 additional terms, to the whole of the work, and all
|
344 |
|
|
its parts, regardless of how they are packaged. This License
|
345 |
|
|
gives no permission to license the work in any other way, but
|
346 |
|
|
it does not invalidate such permission if you have separately
|
347 |
|
|
received it.
|
348 |
|
|
|
349 |
|
|
d. If the work has interactive user interfaces, each must display
|
350 |
|
|
Appropriate Legal Notices; however, if the Program has
|
351 |
|
|
interactive interfaces that do not display Appropriate Legal
|
352 |
|
|
Notices, your work need not make them do so.
|
353 |
|
|
|
354 |
|
|
A compilation of a covered work with other separate and independent
|
355 |
|
|
works, which are not by their nature extensions of the covered
|
356 |
|
|
work, and which are not combined with it such as to form a larger
|
357 |
|
|
program, in or on a volume of a storage or distribution medium, is
|
358 |
|
|
called an "aggregate" if the compilation and its resulting
|
359 |
|
|
copyright are not used to limit the access or legal rights of the
|
360 |
|
|
compilation's users beyond what the individual works permit.
|
361 |
|
|
Inclusion of a covered work in an aggregate does not cause this
|
362 |
|
|
License to apply to the other parts of the aggregate.
|
363 |
|
|
|
364 |
|
|
6. Conveying Non-Source Forms.
|
365 |
|
|
|
366 |
|
|
You may convey a covered work in object code form under the terms
|
367 |
|
|
of sections 4 and 5, provided that you also convey the
|
368 |
|
|
machine-readable Corresponding Source under the terms of this
|
369 |
|
|
License, in one of these ways:
|
370 |
|
|
|
371 |
|
|
a. Convey the object code in, or embodied in, a physical product
|
372 |
|
|
(including a physical distribution medium), accompanied by the
|
373 |
|
|
Corresponding Source fixed on a durable physical medium
|
374 |
|
|
customarily used for software interchange.
|
375 |
|
|
|
376 |
|
|
b. Convey the object code in, or embodied in, a physical product
|
377 |
|
|
(including a physical distribution medium), accompanied by a
|
378 |
|
|
written offer, valid for at least three years and valid for
|
379 |
|
|
as long as you offer spare parts or customer support for that
|
380 |
|
|
product model, to give anyone who possesses the object code
|
381 |
|
|
either (1) a copy of the Corresponding Source for all the
|
382 |
|
|
software in the product that is covered by this License, on a
|
383 |
|
|
durable physical medium customarily used for software
|
384 |
|
|
interchange, for a price no more than your reasonable cost of
|
385 |
|
|
physically performing this conveying of source, or (2) access
|
386 |
|
|
to copy the Corresponding Source from a network server at no
|
387 |
|
|
charge.
|
388 |
|
|
|
389 |
|
|
c. Convey individual copies of the object code with a copy of
|
390 |
|
|
the written offer to provide the Corresponding Source. This
|
391 |
|
|
alternative is allowed only occasionally and noncommercially,
|
392 |
|
|
and only if you received the object code with such an offer,
|
393 |
|
|
in accord with subsection 6b.
|
394 |
|
|
|
395 |
|
|
d. Convey the object code by offering access from a designated
|
396 |
|
|
place (gratis or for a charge), and offer equivalent access
|
397 |
|
|
to the Corresponding Source in the same way through the same
|
398 |
|
|
place at no further charge. You need not require recipients
|
399 |
|
|
to copy the Corresponding Source along with the object code.
|
400 |
|
|
If the place to copy the object code is a network server, the
|
401 |
|
|
Corresponding Source may be on a different server (operated
|
402 |
|
|
by you or a third party) that supports equivalent copying
|
403 |
|
|
facilities, provided you maintain clear directions next to
|
404 |
|
|
the object code saying where to find the Corresponding Source.
|
405 |
|
|
Regardless of what server hosts the Corresponding Source, you
|
406 |
|
|
remain obligated to ensure that it is available for as long
|
407 |
|
|
as needed to satisfy these requirements.
|
408 |
|
|
|
409 |
|
|
e. Convey the object code using peer-to-peer transmission,
|
410 |
|
|
provided you inform other peers where the object code and
|
411 |
|
|
Corresponding Source of the work are being offered to the
|
412 |
|
|
general public at no charge under subsection 6d.
|
413 |
|
|
|
414 |
|
|
|
415 |
|
|
A separable portion of the object code, whose source code is
|
416 |
|
|
excluded from the Corresponding Source as a System Library, need
|
417 |
|
|
not be included in conveying the object code work.
|
418 |
|
|
|
419 |
|
|
A "User Product" is either (1) a "consumer product", which means
|
420 |
|
|
any tangible personal property which is normally used for personal,
|
421 |
|
|
family, or household purposes, or (2) anything designed or sold for
|
422 |
|
|
incorporation into a dwelling. In determining whether a product
|
423 |
|
|
is a consumer product, doubtful cases shall be resolved in favor of
|
424 |
|
|
coverage. For a particular product received by a particular user,
|
425 |
|
|
"normally used" refers to a typical or common use of that class of
|
426 |
|
|
product, regardless of the status of the particular user or of the
|
427 |
|
|
way in which the particular user actually uses, or expects or is
|
428 |
|
|
expected to use, the product. A product is a consumer product
|
429 |
|
|
regardless of whether the product has substantial commercial,
|
430 |
|
|
industrial or non-consumer uses, unless such uses represent the
|
431 |
|
|
only significant mode of use of the product.
|
432 |
|
|
|
433 |
|
|
"Installation Information" for a User Product means any methods,
|
434 |
|
|
procedures, authorization keys, or other information required to
|
435 |
|
|
install and execute modified versions of a covered work in that
|
436 |
|
|
User Product from a modified version of its Corresponding Source.
|
437 |
|
|
The information must suffice to ensure that the continued
|
438 |
|
|
functioning of the modified object code is in no case prevented or
|
439 |
|
|
interfered with solely because modification has been made.
|
440 |
|
|
|
441 |
|
|
If you convey an object code work under this section in, or with,
|
442 |
|
|
or specifically for use in, a User Product, and the conveying
|
443 |
|
|
occurs as part of a transaction in which the right of possession
|
444 |
|
|
and use of the User Product is transferred to the recipient in
|
445 |
|
|
perpetuity or for a fixed term (regardless of how the transaction
|
446 |
|
|
is characterized), the Corresponding Source conveyed under this
|
447 |
|
|
section must be accompanied by the Installation Information. But
|
448 |
|
|
this requirement does not apply if neither you nor any third party
|
449 |
|
|
retains the ability to install modified object code on the User
|
450 |
|
|
Product (for example, the work has been installed in ROM).
|
451 |
|
|
|
452 |
|
|
The requirement to provide Installation Information does not
|
453 |
|
|
include a requirement to continue to provide support service,
|
454 |
|
|
warranty, or updates for a work that has been modified or
|
455 |
|
|
installed by the recipient, or for the User Product in which it
|
456 |
|
|
has been modified or installed. Access to a network may be denied
|
457 |
|
|
when the modification itself materially and adversely affects the
|
458 |
|
|
operation of the network or violates the rules and protocols for
|
459 |
|
|
communication across the network.
|
460 |
|
|
|
461 |
|
|
Corresponding Source conveyed, and Installation Information
|
462 |
|
|
provided, in accord with this section must be in a format that is
|
463 |
|
|
publicly documented (and with an implementation available to the
|
464 |
|
|
public in source code form), and must require no special password
|
465 |
|
|
or key for unpacking, reading or copying.
|
466 |
|
|
|
467 |
|
|
7. Additional Terms.
|
468 |
|
|
|
469 |
|
|
"Additional permissions" are terms that supplement the terms of
|
470 |
|
|
this License by making exceptions from one or more of its
|
471 |
|
|
conditions. Additional permissions that are applicable to the
|
472 |
|
|
entire Program shall be treated as though they were included in
|
473 |
|
|
this License, to the extent that they are valid under applicable
|
474 |
|
|
law. If additional permissions apply only to part of the Program,
|
475 |
|
|
that part may be used separately under those permissions, but the
|
476 |
|
|
entire Program remains governed by this License without regard to
|
477 |
|
|
the additional permissions.
|
478 |
|
|
|
479 |
|
|
When you convey a copy of a covered work, you may at your option
|
480 |
|
|
remove any additional permissions from that copy, or from any part
|
481 |
|
|
of it. (Additional permissions may be written to require their own
|
482 |
|
|
removal in certain cases when you modify the work.) You may place
|
483 |
|
|
additional permissions on material, added by you to a covered work,
|
484 |
|
|
for which you have or can give appropriate copyright permission.
|
485 |
|
|
|
486 |
|
|
Notwithstanding any other provision of this License, for material
|
487 |
|
|
you add to a covered work, you may (if authorized by the copyright
|
488 |
|
|
holders of that material) supplement the terms of this License
|
489 |
|
|
with terms:
|
490 |
|
|
|
491 |
|
|
a. Disclaiming warranty or limiting liability differently from
|
492 |
|
|
the terms of sections 15 and 16 of this License; or
|
493 |
|
|
|
494 |
|
|
b. Requiring preservation of specified reasonable legal notices
|
495 |
|
|
or author attributions in that material or in the Appropriate
|
496 |
|
|
Legal Notices displayed by works containing it; or
|
497 |
|
|
|
498 |
|
|
c. Prohibiting misrepresentation of the origin of that material,
|
499 |
|
|
or requiring that modified versions of such material be
|
500 |
|
|
marked in reasonable ways as different from the original
|
501 |
|
|
version; or
|
502 |
|
|
|
503 |
|
|
d. Limiting the use for publicity purposes of names of licensors
|
504 |
|
|
or authors of the material; or
|
505 |
|
|
|
506 |
|
|
e. Declining to grant rights under trademark law for use of some
|
507 |
|
|
trade names, trademarks, or service marks; or
|
508 |
|
|
|
509 |
|
|
f. Requiring indemnification of licensors and authors of that
|
510 |
|
|
material by anyone who conveys the material (or modified
|
511 |
|
|
versions of it) with contractual assumptions of liability to
|
512 |
|
|
the recipient, for any liability that these contractual
|
513 |
|
|
assumptions directly impose on those licensors and authors.
|
514 |
|
|
|
515 |
|
|
All other non-permissive additional terms are considered "further
|
516 |
|
|
restrictions" within the meaning of section 10. If the Program as
|
517 |
|
|
you received it, or any part of it, contains a notice stating that
|
518 |
|
|
it is governed by this License along with a term that is a further
|
519 |
|
|
restriction, you may remove that term. If a license document
|
520 |
|
|
contains a further restriction but permits relicensing or
|
521 |
|
|
conveying under this License, you may add to a covered work
|
522 |
|
|
material governed by the terms of that license document, provided
|
523 |
|
|
that the further restriction does not survive such relicensing or
|
524 |
|
|
conveying.
|
525 |
|
|
|
526 |
|
|
If you add terms to a covered work in accord with this section, you
|
527 |
|
|
must place, in the relevant source files, a statement of the
|
528 |
|
|
additional terms that apply to those files, or a notice indicating
|
529 |
|
|
where to find the applicable terms.
|
530 |
|
|
|
531 |
|
|
Additional terms, permissive or non-permissive, may be stated in
|
532 |
|
|
the form of a separately written license, or stated as exceptions;
|
533 |
|
|
the above requirements apply either way.
|
534 |
|
|
|
535 |
|
|
8. Termination.
|
536 |
|
|
|
537 |
|
|
You may not propagate or modify a covered work except as expressly
|
538 |
|
|
provided under this License. Any attempt otherwise to propagate or
|
539 |
|
|
modify it is void, and will automatically terminate your rights
|
540 |
|
|
under this License (including any patent licenses granted under
|
541 |
|
|
the third paragraph of section 11).
|
542 |
|
|
|
543 |
|
|
However, if you cease all violation of this License, then your
|
544 |
|
|
license from a particular copyright holder is reinstated (a)
|
545 |
|
|
provisionally, unless and until the copyright holder explicitly
|
546 |
|
|
and finally terminates your license, and (b) permanently, if the
|
547 |
|
|
copyright holder fails to notify you of the violation by some
|
548 |
|
|
reasonable means prior to 60 days after the cessation.
|
549 |
|
|
|
550 |
|
|
Moreover, your license from a particular copyright holder is
|
551 |
|
|
reinstated permanently if the copyright holder notifies you of the
|
552 |
|
|
violation by some reasonable means, this is the first time you have
|
553 |
|
|
received notice of violation of this License (for any work) from
|
554 |
|
|
that copyright holder, and you cure the violation prior to 30 days
|
555 |
|
|
after your receipt of the notice.
|
556 |
|
|
|
557 |
|
|
Termination of your rights under this section does not terminate
|
558 |
|
|
the licenses of parties who have received copies or rights from
|
559 |
|
|
you under this License. If your rights have been terminated and
|
560 |
|
|
not permanently reinstated, you do not qualify to receive new
|
561 |
|
|
licenses for the same material under section 10.
|
562 |
|
|
|
563 |
|
|
9. Acceptance Not Required for Having Copies.
|
564 |
|
|
|
565 |
|
|
You are not required to accept this License in order to receive or
|
566 |
|
|
run a copy of the Program. Ancillary propagation of a covered work
|
567 |
|
|
occurring solely as a consequence of using peer-to-peer
|
568 |
|
|
transmission to receive a copy likewise does not require
|
569 |
|
|
acceptance. However, nothing other than this License grants you
|
570 |
|
|
permission to propagate or modify any covered work. These actions
|
571 |
|
|
infringe copyright if you do not accept this License. Therefore,
|
572 |
|
|
by modifying or propagating a covered work, you indicate your
|
573 |
|
|
acceptance of this License to do so.
|
574 |
|
|
|
575 |
|
|
10. Automatic Licensing of Downstream Recipients.
|
576 |
|
|
|
577 |
|
|
Each time you convey a covered work, the recipient automatically
|
578 |
|
|
receives a license from the original licensors, to run, modify and
|
579 |
|
|
propagate that work, subject to this License. You are not
|
580 |
|
|
responsible for enforcing compliance by third parties with this
|
581 |
|
|
License.
|
582 |
|
|
|
583 |
|
|
An "entity transaction" is a transaction transferring control of an
|
584 |
|
|
organization, or substantially all assets of one, or subdividing an
|
585 |
|
|
organization, or merging organizations. If propagation of a
|
586 |
|
|
covered work results from an entity transaction, each party to that
|
587 |
|
|
transaction who receives a copy of the work also receives whatever
|
588 |
|
|
licenses to the work the party's predecessor in interest had or
|
589 |
|
|
could give under the previous paragraph, plus a right to
|
590 |
|
|
possession of the Corresponding Source of the work from the
|
591 |
|
|
predecessor in interest, if the predecessor has it or can get it
|
592 |
|
|
with reasonable efforts.
|
593 |
|
|
|
594 |
|
|
You may not impose any further restrictions on the exercise of the
|
595 |
|
|
rights granted or affirmed under this License. For example, you
|
596 |
|
|
may not impose a license fee, royalty, or other charge for
|
597 |
|
|
exercise of rights granted under this License, and you may not
|
598 |
|
|
initiate litigation (including a cross-claim or counterclaim in a
|
599 |
|
|
lawsuit) alleging that any patent claim is infringed by making,
|
600 |
|
|
using, selling, offering for sale, or importing the Program or any
|
601 |
|
|
portion of it.
|
602 |
|
|
|
603 |
|
|
11. Patents.
|
604 |
|
|
|
605 |
|
|
A "contributor" is a copyright holder who authorizes use under this
|
606 |
|
|
License of the Program or a work on which the Program is based.
|
607 |
|
|
The work thus licensed is called the contributor's "contributor
|
608 |
|
|
version".
|
609 |
|
|
|
610 |
|
|
A contributor's "essential patent claims" are all patent claims
|
611 |
|
|
owned or controlled by the contributor, whether already acquired or
|
612 |
|
|
hereafter acquired, that would be infringed by some manner,
|
613 |
|
|
permitted by this License, of making, using, or selling its
|
614 |
|
|
contributor version, but do not include claims that would be
|
615 |
|
|
infringed only as a consequence of further modification of the
|
616 |
|
|
contributor version. For purposes of this definition, "control"
|
617 |
|
|
includes the right to grant patent sublicenses in a manner
|
618 |
|
|
consistent with the requirements of this License.
|
619 |
|
|
|
620 |
|
|
Each contributor grants you a non-exclusive, worldwide,
|
621 |
|
|
royalty-free patent license under the contributor's essential
|
622 |
|
|
patent claims, to make, use, sell, offer for sale, import and
|
623 |
|
|
otherwise run, modify and propagate the contents of its
|
624 |
|
|
contributor version.
|
625 |
|
|
|
626 |
|
|
In the following three paragraphs, a "patent license" is any
|
627 |
|
|
express agreement or commitment, however denominated, not to
|
628 |
|
|
enforce a patent (such as an express permission to practice a
|
629 |
|
|
patent or covenant not to sue for patent infringement). To
|
630 |
|
|
"grant" such a patent license to a party means to make such an
|
631 |
|
|
agreement or commitment not to enforce a patent against the party.
|
632 |
|
|
|
633 |
|
|
If you convey a covered work, knowingly relying on a patent
|
634 |
|
|
license, and the Corresponding Source of the work is not available
|
635 |
|
|
for anyone to copy, free of charge and under the terms of this
|
636 |
|
|
License, through a publicly available network server or other
|
637 |
|
|
readily accessible means, then you must either (1) cause the
|
638 |
|
|
Corresponding Source to be so available, or (2) arrange to deprive
|
639 |
|
|
yourself of the benefit of the patent license for this particular
|
640 |
|
|
work, or (3) arrange, in a manner consistent with the requirements
|
641 |
|
|
of this License, to extend the patent license to downstream
|
642 |
|
|
recipients. "Knowingly relying" means you have actual knowledge
|
643 |
|
|
that, but for the patent license, your conveying the covered work
|
644 |
|
|
in a country, or your recipient's use of the covered work in a
|
645 |
|
|
country, would infringe one or more identifiable patents in that
|
646 |
|
|
country that you have reason to believe are valid.
|
647 |
|
|
|
648 |
|
|
If, pursuant to or in connection with a single transaction or
|
649 |
|
|
arrangement, you convey, or propagate by procuring conveyance of, a
|
650 |
|
|
covered work, and grant a patent license to some of the parties
|
651 |
|
|
receiving the covered work authorizing them to use, propagate,
|
652 |
|
|
modify or convey a specific copy of the covered work, then the
|
653 |
|
|
patent license you grant is automatically extended to all
|
654 |
|
|
recipients of the covered work and works based on it.
|
655 |
|
|
|
656 |
|
|
A patent license is "discriminatory" if it does not include within
|
657 |
|
|
the scope of its coverage, prohibits the exercise of, or is
|
658 |
|
|
conditioned on the non-exercise of one or more of the rights that
|
659 |
|
|
are specifically granted under this License. You may not convey a
|
660 |
|
|
covered work if you are a party to an arrangement with a third
|
661 |
|
|
party that is in the business of distributing software, under
|
662 |
|
|
which you make payment to the third party based on the extent of
|
663 |
|
|
your activity of conveying the work, and under which the third
|
664 |
|
|
party grants, to any of the parties who would receive the covered
|
665 |
|
|
work from you, a discriminatory patent license (a) in connection
|
666 |
|
|
with copies of the covered work conveyed by you (or copies made
|
667 |
|
|
from those copies), or (b) primarily for and in connection with
|
668 |
|
|
specific products or compilations that contain the covered work,
|
669 |
|
|
unless you entered into that arrangement, or that patent license
|
670 |
|
|
was granted, prior to 28 March 2007.
|
671 |
|
|
|
672 |
|
|
Nothing in this License shall be construed as excluding or limiting
|
673 |
|
|
any implied license or other defenses to infringement that may
|
674 |
|
|
otherwise be available to you under applicable patent law.
|
675 |
|
|
|
676 |
|
|
12. No Surrender of Others' Freedom.
|
677 |
|
|
|
678 |
|
|
If conditions are imposed on you (whether by court order,
|
679 |
|
|
agreement or otherwise) that contradict the conditions of this
|
680 |
|
|
License, they do not excuse you from the conditions of this
|
681 |
|
|
License. If you cannot convey a covered work so as to satisfy
|
682 |
|
|
simultaneously your obligations under this License and any other
|
683 |
|
|
pertinent obligations, then as a consequence you may not convey it
|
684 |
|
|
at all. For example, if you agree to terms that obligate you to
|
685 |
|
|
collect a royalty for further conveying from those to whom you
|
686 |
|
|
convey the Program, the only way you could satisfy both those
|
687 |
|
|
terms and this License would be to refrain entirely from conveying
|
688 |
|
|
the Program.
|
689 |
|
|
|
690 |
|
|
13. Use with the GNU Affero General Public License.
|
691 |
|
|
|
692 |
|
|
Notwithstanding any other provision of this License, you have
|
693 |
|
|
permission to link or combine any covered work with a work licensed
|
694 |
|
|
under version 3 of the GNU Affero General Public License into a
|
695 |
|
|
single combined work, and to convey the resulting work. The terms
|
696 |
|
|
of this License will continue to apply to the part which is the
|
697 |
|
|
covered work, but the special requirements of the GNU Affero
|
698 |
|
|
General Public License, section 13, concerning interaction through
|
699 |
|
|
a network will apply to the combination as such.
|
700 |
|
|
|
701 |
|
|
14. Revised Versions of this License.
|
702 |
|
|
|
703 |
|
|
The Free Software Foundation may publish revised and/or new
|
704 |
|
|
versions of the GNU General Public License from time to time.
|
705 |
|
|
Such new versions will be similar in spirit to the present
|
706 |
|
|
version, but may differ in detail to address new problems or
|
707 |
|
|
concerns.
|
708 |
|
|
|
709 |
|
|
Each version is given a distinguishing version number. If the
|
710 |
|
|
Program specifies that a certain numbered version of the GNU
|
711 |
|
|
General Public License "or any later version" applies to it, you
|
712 |
|
|
have the option of following the terms and conditions either of
|
713 |
|
|
that numbered version or of any later version published by the
|
714 |
|
|
Free Software Foundation. If the Program does not specify a
|
715 |
|
|
version number of the GNU General Public License, you may choose
|
716 |
|
|
any version ever published by the Free Software Foundation.
|
717 |
|
|
|
718 |
|
|
If the Program specifies that a proxy can decide which future
|
719 |
|
|
versions of the GNU General Public License can be used, that
|
720 |
|
|
proxy's public statement of acceptance of a version permanently
|
721 |
|
|
authorizes you to choose that version for the Program.
|
722 |
|
|
|
723 |
|
|
Later license versions may give you additional or different
|
724 |
|
|
permissions. However, no additional obligations are imposed on any
|
725 |
|
|
author or copyright holder as a result of your choosing to follow a
|
726 |
|
|
later version.
|
727 |
|
|
|
728 |
|
|
15. Disclaimer of Warranty.
|
729 |
|
|
|
730 |
|
|
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
731 |
|
|
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE
|
732 |
|
|
COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS"
|
733 |
|
|
WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
|
734 |
|
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
735 |
|
|
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE
|
736 |
|
|
RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.
|
737 |
|
|
SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
|
738 |
|
|
NECESSARY SERVICING, REPAIR OR CORRECTION.
|
739 |
|
|
|
740 |
|
|
16. Limitation of Liability.
|
741 |
|
|
|
742 |
|
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
743 |
|
|
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES
|
744 |
|
|
AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU
|
745 |
|
|
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
746 |
|
|
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE
|
747 |
|
|
THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA
|
748 |
|
|
BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
749 |
|
|
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
750 |
|
|
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF
|
751 |
|
|
THE POSSIBILITY OF SUCH DAMAGES.
|
752 |
|
|
|
753 |
|
|
17. Interpretation of Sections 15 and 16.
|
754 |
|
|
|
755 |
|
|
If the disclaimer of warranty and limitation of liability provided
|
756 |
|
|
above cannot be given local legal effect according to their terms,
|
757 |
|
|
reviewing courts shall apply local law that most closely
|
758 |
|
|
approximates an absolute waiver of all civil liability in
|
759 |
|
|
connection with the Program, unless a warranty or assumption of
|
760 |
|
|
liability accompanies a copy of the Program in return for a fee.
|
761 |
|
|
|
762 |
|
|
|
763 |
|
|
END OF TERMS AND CONDITIONS
|
764 |
|
|
===========================
|
765 |
|
|
|
766 |
|
|
How to Apply These Terms to Your New Programs
|
767 |
|
|
=============================================
|
768 |
|
|
|
769 |
|
|
If you develop a new program, and you want it to be of the greatest
|
770 |
|
|
possible use to the public, the best way to achieve this is to make it
|
771 |
|
|
free software which everyone can redistribute and change under these
|
772 |
|
|
terms.
|
773 |
|
|
|
774 |
|
|
To do so, attach the following notices to the program. It is safest
|
775 |
|
|
to attach them to the start of each source file to most effectively
|
776 |
|
|
state the exclusion of warranty; and each file should have at least the
|
777 |
|
|
"copyright" line and a pointer to where the full notice is found.
|
778 |
|
|
|
779 |
|
|
ONE LINE TO GIVE THE PROGRAM'S NAME AND A BRIEF IDEA OF WHAT IT DOES.
|
780 |
|
|
Copyright (C) YEAR NAME OF AUTHOR
|
781 |
|
|
|
782 |
|
|
This program is free software: you can redistribute it and/or modify
|
783 |
|
|
it under the terms of the GNU General Public License as published by
|
784 |
|
|
the Free Software Foundation, either version 3 of the License, or (at
|
785 |
|
|
your option) any later version.
|
786 |
|
|
|
787 |
|
|
This program is distributed in the hope that it will be useful, but
|
788 |
|
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
789 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
790 |
|
|
General Public License for more details.
|
791 |
|
|
|
792 |
|
|
You should have received a copy of the GNU General Public License
|
793 |
|
|
along with this program. If not, see `http://www.gnu.org/licenses/'.
|
794 |
|
|
|
795 |
|
|
Also add information on how to contact you by electronic and paper
|
796 |
|
|
mail.
|
797 |
|
|
|
798 |
|
|
If the program does terminal interaction, make it output a short
|
799 |
|
|
notice like this when it starts in an interactive mode:
|
800 |
|
|
|
801 |
|
|
PROGRAM Copyright (C) YEAR NAME OF AUTHOR
|
802 |
|
|
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
803 |
|
|
This is free software, and you are welcome to redistribute it
|
804 |
|
|
under certain conditions; type `show c' for details.
|
805 |
|
|
|
806 |
|
|
The hypothetical commands `show w' and `show c' should show the
|
807 |
|
|
appropriate parts of the General Public License. Of course, your
|
808 |
|
|
program's commands might be different; for a GUI interface, you would
|
809 |
|
|
use an "about box".
|
810 |
|
|
|
811 |
|
|
You should also get your employer (if you work as a programmer) or
|
812 |
|
|
school, if any, to sign a "copyright disclaimer" for the program, if
|
813 |
|
|
necessary. For more information on this, and how to apply and follow
|
814 |
|
|
the GNU GPL, see `http://www.gnu.org/licenses/'.
|
815 |
|
|
|
816 |
|
|
The GNU General Public License does not permit incorporating your
|
817 |
|
|
program into proprietary programs. If your program is a subroutine
|
818 |
|
|
library, you may consider it more useful to permit linking proprietary
|
819 |
|
|
applications with the library. If this is what you want to do, use the
|
820 |
|
|
GNU Lesser General Public License instead of this License. But first,
|
821 |
|
|
please read `http://www.gnu.org/philosophy/why-not-lgpl.html'.
|
822 |
|
|
|
823 |
|
|
|
824 |
|
|
File: gcj.info, Node: GNU Free Documentation License, Next: Invoking gcj, Prev: Copying, Up: Top
|
825 |
|
|
|
826 |
|
|
GNU Free Documentation License
|
827 |
|
|
******************************
|
828 |
|
|
|
829 |
|
|
Version 1.2, November 2002
|
830 |
|
|
|
831 |
|
|
Copyright (C) 2000,2001,2002 Free Software Foundation, Inc.
|
832 |
|
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
833 |
|
|
|
834 |
|
|
Everyone is permitted to copy and distribute verbatim copies
|
835 |
|
|
of this license document, but changing it is not allowed.
|
836 |
|
|
|
837 |
|
|
0. PREAMBLE
|
838 |
|
|
|
839 |
|
|
The purpose of this License is to make a manual, textbook, or other
|
840 |
|
|
functional and useful document "free" in the sense of freedom: to
|
841 |
|
|
assure everyone the effective freedom to copy and redistribute it,
|
842 |
|
|
with or without modifying it, either commercially or
|
843 |
|
|
noncommercially. Secondarily, this License preserves for the
|
844 |
|
|
author and publisher a way to get credit for their work, while not
|
845 |
|
|
being considered responsible for modifications made by others.
|
846 |
|
|
|
847 |
|
|
This License is a kind of "copyleft", which means that derivative
|
848 |
|
|
works of the document must themselves be free in the same sense.
|
849 |
|
|
It complements the GNU General Public License, which is a copyleft
|
850 |
|
|
license designed for free software.
|
851 |
|
|
|
852 |
|
|
We have designed this License in order to use it for manuals for
|
853 |
|
|
free software, because free software needs free documentation: a
|
854 |
|
|
free program should come with manuals providing the same freedoms
|
855 |
|
|
that the software does. But this License is not limited to
|
856 |
|
|
software manuals; it can be used for any textual work, regardless
|
857 |
|
|
of subject matter or whether it is published as a printed book.
|
858 |
|
|
We recommend this License principally for works whose purpose is
|
859 |
|
|
instruction or reference.
|
860 |
|
|
|
861 |
|
|
1. APPLICABILITY AND DEFINITIONS
|
862 |
|
|
|
863 |
|
|
This License applies to any manual or other work, in any medium,
|
864 |
|
|
that contains a notice placed by the copyright holder saying it
|
865 |
|
|
can be distributed under the terms of this License. Such a notice
|
866 |
|
|
grants a world-wide, royalty-free license, unlimited in duration,
|
867 |
|
|
to use that work under the conditions stated herein. The
|
868 |
|
|
"Document", below, refers to any such manual or work. Any member
|
869 |
|
|
of the public is a licensee, and is addressed as "you". You
|
870 |
|
|
accept the license if you copy, modify or distribute the work in a
|
871 |
|
|
way requiring permission under copyright law.
|
872 |
|
|
|
873 |
|
|
A "Modified Version" of the Document means any work containing the
|
874 |
|
|
Document or a portion of it, either copied verbatim, or with
|
875 |
|
|
modifications and/or translated into another language.
|
876 |
|
|
|
877 |
|
|
A "Secondary Section" is a named appendix or a front-matter section
|
878 |
|
|
of the Document that deals exclusively with the relationship of the
|
879 |
|
|
publishers or authors of the Document to the Document's overall
|
880 |
|
|
subject (or to related matters) and contains nothing that could
|
881 |
|
|
fall directly within that overall subject. (Thus, if the Document
|
882 |
|
|
is in part a textbook of mathematics, a Secondary Section may not
|
883 |
|
|
explain any mathematics.) The relationship could be a matter of
|
884 |
|
|
historical connection with the subject or with related matters, or
|
885 |
|
|
of legal, commercial, philosophical, ethical or political position
|
886 |
|
|
regarding them.
|
887 |
|
|
|
888 |
|
|
The "Invariant Sections" are certain Secondary Sections whose
|
889 |
|
|
titles are designated, as being those of Invariant Sections, in
|
890 |
|
|
the notice that says that the Document is released under this
|
891 |
|
|
License. If a section does not fit the above definition of
|
892 |
|
|
Secondary then it is not allowed to be designated as Invariant.
|
893 |
|
|
The Document may contain zero Invariant Sections. If the Document
|
894 |
|
|
does not identify any Invariant Sections then there are none.
|
895 |
|
|
|
896 |
|
|
The "Cover Texts" are certain short passages of text that are
|
897 |
|
|
listed, as Front-Cover Texts or Back-Cover Texts, in the notice
|
898 |
|
|
that says that the Document is released under this License. A
|
899 |
|
|
Front-Cover Text may be at most 5 words, and a Back-Cover Text may
|
900 |
|
|
be at most 25 words.
|
901 |
|
|
|
902 |
|
|
A "Transparent" copy of the Document means a machine-readable copy,
|
903 |
|
|
represented in a format whose specification is available to the
|
904 |
|
|
general public, that is suitable for revising the document
|
905 |
|
|
straightforwardly with generic text editors or (for images
|
906 |
|
|
composed of pixels) generic paint programs or (for drawings) some
|
907 |
|
|
widely available drawing editor, and that is suitable for input to
|
908 |
|
|
text formatters or for automatic translation to a variety of
|
909 |
|
|
formats suitable for input to text formatters. A copy made in an
|
910 |
|
|
otherwise Transparent file format whose markup, or absence of
|
911 |
|
|
markup, has been arranged to thwart or discourage subsequent
|
912 |
|
|
modification by readers is not Transparent. An image format is
|
913 |
|
|
not Transparent if used for any substantial amount of text. A
|
914 |
|
|
copy that is not "Transparent" is called "Opaque".
|
915 |
|
|
|
916 |
|
|
Examples of suitable formats for Transparent copies include plain
|
917 |
|
|
ASCII without markup, Texinfo input format, LaTeX input format,
|
918 |
|
|
SGML or XML using a publicly available DTD, and
|
919 |
|
|
standard-conforming simple HTML, PostScript or PDF designed for
|
920 |
|
|
human modification. Examples of transparent image formats include
|
921 |
|
|
PNG, XCF and JPG. Opaque formats include proprietary formats that
|
922 |
|
|
can be read and edited only by proprietary word processors, SGML or
|
923 |
|
|
XML for which the DTD and/or processing tools are not generally
|
924 |
|
|
available, and the machine-generated HTML, PostScript or PDF
|
925 |
|
|
produced by some word processors for output purposes only.
|
926 |
|
|
|
927 |
|
|
The "Title Page" means, for a printed book, the title page itself,
|
928 |
|
|
plus such following pages as are needed to hold, legibly, the
|
929 |
|
|
material this License requires to appear in the title page. For
|
930 |
|
|
works in formats which do not have any title page as such, "Title
|
931 |
|
|
Page" means the text near the most prominent appearance of the
|
932 |
|
|
work's title, preceding the beginning of the body of the text.
|
933 |
|
|
|
934 |
|
|
A section "Entitled XYZ" means a named subunit of the Document
|
935 |
|
|
whose title either is precisely XYZ or contains XYZ in parentheses
|
936 |
|
|
following text that translates XYZ in another language. (Here XYZ
|
937 |
|
|
stands for a specific section name mentioned below, such as
|
938 |
|
|
"Acknowledgements", "Dedications", "Endorsements", or "History".)
|
939 |
|
|
To "Preserve the Title" of such a section when you modify the
|
940 |
|
|
Document means that it remains a section "Entitled XYZ" according
|
941 |
|
|
to this definition.
|
942 |
|
|
|
943 |
|
|
The Document may include Warranty Disclaimers next to the notice
|
944 |
|
|
which states that this License applies to the Document. These
|
945 |
|
|
Warranty Disclaimers are considered to be included by reference in
|
946 |
|
|
this License, but only as regards disclaiming warranties: any other
|
947 |
|
|
implication that these Warranty Disclaimers may have is void and
|
948 |
|
|
has no effect on the meaning of this License.
|
949 |
|
|
|
950 |
|
|
2. VERBATIM COPYING
|
951 |
|
|
|
952 |
|
|
You may copy and distribute the Document in any medium, either
|
953 |
|
|
commercially or noncommercially, provided that this License, the
|
954 |
|
|
copyright notices, and the license notice saying this License
|
955 |
|
|
applies to the Document are reproduced in all copies, and that you
|
956 |
|
|
add no other conditions whatsoever to those of this License. You
|
957 |
|
|
may not use technical measures to obstruct or control the reading
|
958 |
|
|
or further copying of the copies you make or distribute. However,
|
959 |
|
|
you may accept compensation in exchange for copies. If you
|
960 |
|
|
distribute a large enough number of copies you must also follow
|
961 |
|
|
the conditions in section 3.
|
962 |
|
|
|
963 |
|
|
You may also lend copies, under the same conditions stated above,
|
964 |
|
|
and you may publicly display copies.
|
965 |
|
|
|
966 |
|
|
3. COPYING IN QUANTITY
|
967 |
|
|
|
968 |
|
|
If you publish printed copies (or copies in media that commonly
|
969 |
|
|
have printed covers) of the Document, numbering more than 100, and
|
970 |
|
|
the Document's license notice requires Cover Texts, you must
|
971 |
|
|
enclose the copies in covers that carry, clearly and legibly, all
|
972 |
|
|
these Cover Texts: Front-Cover Texts on the front cover, and
|
973 |
|
|
Back-Cover Texts on the back cover. Both covers must also clearly
|
974 |
|
|
and legibly identify you as the publisher of these copies. The
|
975 |
|
|
front cover must present the full title with all words of the
|
976 |
|
|
title equally prominent and visible. You may add other material
|
977 |
|
|
on the covers in addition. Copying with changes limited to the
|
978 |
|
|
covers, as long as they preserve the title of the Document and
|
979 |
|
|
satisfy these conditions, can be treated as verbatim copying in
|
980 |
|
|
other respects.
|
981 |
|
|
|
982 |
|
|
If the required texts for either cover are too voluminous to fit
|
983 |
|
|
legibly, you should put the first ones listed (as many as fit
|
984 |
|
|
reasonably) on the actual cover, and continue the rest onto
|
985 |
|
|
adjacent pages.
|
986 |
|
|
|
987 |
|
|
If you publish or distribute Opaque copies of the Document
|
988 |
|
|
numbering more than 100, you must either include a
|
989 |
|
|
machine-readable Transparent copy along with each Opaque copy, or
|
990 |
|
|
state in or with each Opaque copy a computer-network location from
|
991 |
|
|
which the general network-using public has access to download
|
992 |
|
|
using public-standard network protocols a complete Transparent
|
993 |
|
|
copy of the Document, free of added material. If you use the
|
994 |
|
|
latter option, you must take reasonably prudent steps, when you
|
995 |
|
|
begin distribution of Opaque copies in quantity, to ensure that
|
996 |
|
|
this Transparent copy will remain thus accessible at the stated
|
997 |
|
|
location until at least one year after the last time you
|
998 |
|
|
distribute an Opaque copy (directly or through your agents or
|
999 |
|
|
retailers) of that edition to the public.
|
1000 |
|
|
|
1001 |
|
|
It is requested, but not required, that you contact the authors of
|
1002 |
|
|
the Document well before redistributing any large number of
|
1003 |
|
|
copies, to give them a chance to provide you with an updated
|
1004 |
|
|
version of the Document.
|
1005 |
|
|
|
1006 |
|
|
4. MODIFICATIONS
|
1007 |
|
|
|
1008 |
|
|
You may copy and distribute a Modified Version of the Document
|
1009 |
|
|
under the conditions of sections 2 and 3 above, provided that you
|
1010 |
|
|
release the Modified Version under precisely this License, with
|
1011 |
|
|
the Modified Version filling the role of the Document, thus
|
1012 |
|
|
licensing distribution and modification of the Modified Version to
|
1013 |
|
|
whoever possesses a copy of it. In addition, you must do these
|
1014 |
|
|
things in the Modified Version:
|
1015 |
|
|
|
1016 |
|
|
A. Use in the Title Page (and on the covers, if any) a title
|
1017 |
|
|
distinct from that of the Document, and from those of
|
1018 |
|
|
previous versions (which should, if there were any, be listed
|
1019 |
|
|
in the History section of the Document). You may use the
|
1020 |
|
|
same title as a previous version if the original publisher of
|
1021 |
|
|
that version gives permission.
|
1022 |
|
|
|
1023 |
|
|
B. List on the Title Page, as authors, one or more persons or
|
1024 |
|
|
entities responsible for authorship of the modifications in
|
1025 |
|
|
the Modified Version, together with at least five of the
|
1026 |
|
|
principal authors of the Document (all of its principal
|
1027 |
|
|
authors, if it has fewer than five), unless they release you
|
1028 |
|
|
from this requirement.
|
1029 |
|
|
|
1030 |
|
|
C. State on the Title page the name of the publisher of the
|
1031 |
|
|
Modified Version, as the publisher.
|
1032 |
|
|
|
1033 |
|
|
D. Preserve all the copyright notices of the Document.
|
1034 |
|
|
|
1035 |
|
|
E. Add an appropriate copyright notice for your modifications
|
1036 |
|
|
adjacent to the other copyright notices.
|
1037 |
|
|
|
1038 |
|
|
F. Include, immediately after the copyright notices, a license
|
1039 |
|
|
notice giving the public permission to use the Modified
|
1040 |
|
|
Version under the terms of this License, in the form shown in
|
1041 |
|
|
the Addendum below.
|
1042 |
|
|
|
1043 |
|
|
G. Preserve in that license notice the full lists of Invariant
|
1044 |
|
|
Sections and required Cover Texts given in the Document's
|
1045 |
|
|
license notice.
|
1046 |
|
|
|
1047 |
|
|
H. Include an unaltered copy of this License.
|
1048 |
|
|
|
1049 |
|
|
I. Preserve the section Entitled "History", Preserve its Title,
|
1050 |
|
|
and add to it an item stating at least the title, year, new
|
1051 |
|
|
authors, and publisher of the Modified Version as given on
|
1052 |
|
|
the Title Page. If there is no section Entitled "History" in
|
1053 |
|
|
the Document, create one stating the title, year, authors,
|
1054 |
|
|
and publisher of the Document as given on its Title Page,
|
1055 |
|
|
then add an item describing the Modified Version as stated in
|
1056 |
|
|
the previous sentence.
|
1057 |
|
|
|
1058 |
|
|
J. Preserve the network location, if any, given in the Document
|
1059 |
|
|
for public access to a Transparent copy of the Document, and
|
1060 |
|
|
likewise the network locations given in the Document for
|
1061 |
|
|
previous versions it was based on. These may be placed in
|
1062 |
|
|
the "History" section. You may omit a network location for a
|
1063 |
|
|
work that was published at least four years before the
|
1064 |
|
|
Document itself, or if the original publisher of the version
|
1065 |
|
|
it refers to gives permission.
|
1066 |
|
|
|
1067 |
|
|
K. For any section Entitled "Acknowledgements" or "Dedications",
|
1068 |
|
|
Preserve the Title of the section, and preserve in the
|
1069 |
|
|
section all the substance and tone of each of the contributor
|
1070 |
|
|
acknowledgements and/or dedications given therein.
|
1071 |
|
|
|
1072 |
|
|
L. Preserve all the Invariant Sections of the Document,
|
1073 |
|
|
unaltered in their text and in their titles. Section numbers
|
1074 |
|
|
or the equivalent are not considered part of the section
|
1075 |
|
|
titles.
|
1076 |
|
|
|
1077 |
|
|
M. Delete any section Entitled "Endorsements". Such a section
|
1078 |
|
|
may not be included in the Modified Version.
|
1079 |
|
|
|
1080 |
|
|
N. Do not retitle any existing section to be Entitled
|
1081 |
|
|
"Endorsements" or to conflict in title with any Invariant
|
1082 |
|
|
Section.
|
1083 |
|
|
|
1084 |
|
|
O. Preserve any Warranty Disclaimers.
|
1085 |
|
|
|
1086 |
|
|
If the Modified Version includes new front-matter sections or
|
1087 |
|
|
appendices that qualify as Secondary Sections and contain no
|
1088 |
|
|
material copied from the Document, you may at your option
|
1089 |
|
|
designate some or all of these sections as invariant. To do this,
|
1090 |
|
|
add their titles to the list of Invariant Sections in the Modified
|
1091 |
|
|
Version's license notice. These titles must be distinct from any
|
1092 |
|
|
other section titles.
|
1093 |
|
|
|
1094 |
|
|
You may add a section Entitled "Endorsements", provided it contains
|
1095 |
|
|
nothing but endorsements of your Modified Version by various
|
1096 |
|
|
parties--for example, statements of peer review or that the text
|
1097 |
|
|
has been approved by an organization as the authoritative
|
1098 |
|
|
definition of a standard.
|
1099 |
|
|
|
1100 |
|
|
You may add a passage of up to five words as a Front-Cover Text,
|
1101 |
|
|
and a passage of up to 25 words as a Back-Cover Text, to the end
|
1102 |
|
|
of the list of Cover Texts in the Modified Version. Only one
|
1103 |
|
|
passage of Front-Cover Text and one of Back-Cover Text may be
|
1104 |
|
|
added by (or through arrangements made by) any one entity. If the
|
1105 |
|
|
Document already includes a cover text for the same cover,
|
1106 |
|
|
previously added by you or by arrangement made by the same entity
|
1107 |
|
|
you are acting on behalf of, you may not add another; but you may
|
1108 |
|
|
replace the old one, on explicit permission from the previous
|
1109 |
|
|
publisher that added the old one.
|
1110 |
|
|
|
1111 |
|
|
The author(s) and publisher(s) of the Document do not by this
|
1112 |
|
|
License give permission to use their names for publicity for or to
|
1113 |
|
|
assert or imply endorsement of any Modified Version.
|
1114 |
|
|
|
1115 |
|
|
5. COMBINING DOCUMENTS
|
1116 |
|
|
|
1117 |
|
|
You may combine the Document with other documents released under
|
1118 |
|
|
this License, under the terms defined in section 4 above for
|
1119 |
|
|
modified versions, provided that you include in the combination
|
1120 |
|
|
all of the Invariant Sections of all of the original documents,
|
1121 |
|
|
unmodified, and list them all as Invariant Sections of your
|
1122 |
|
|
combined work in its license notice, and that you preserve all
|
1123 |
|
|
their Warranty Disclaimers.
|
1124 |
|
|
|
1125 |
|
|
The combined work need only contain one copy of this License, and
|
1126 |
|
|
multiple identical Invariant Sections may be replaced with a single
|
1127 |
|
|
copy. If there are multiple Invariant Sections with the same name
|
1128 |
|
|
but different contents, make the title of each such section unique
|
1129 |
|
|
by adding at the end of it, in parentheses, the name of the
|
1130 |
|
|
original author or publisher of that section if known, or else a
|
1131 |
|
|
unique number. Make the same adjustment to the section titles in
|
1132 |
|
|
the list of Invariant Sections in the license notice of the
|
1133 |
|
|
combined work.
|
1134 |
|
|
|
1135 |
|
|
In the combination, you must combine any sections Entitled
|
1136 |
|
|
"History" in the various original documents, forming one section
|
1137 |
|
|
Entitled "History"; likewise combine any sections Entitled
|
1138 |
|
|
"Acknowledgements", and any sections Entitled "Dedications". You
|
1139 |
|
|
must delete all sections Entitled "Endorsements."
|
1140 |
|
|
|
1141 |
|
|
6. COLLECTIONS OF DOCUMENTS
|
1142 |
|
|
|
1143 |
|
|
You may make a collection consisting of the Document and other
|
1144 |
|
|
documents released under this License, and replace the individual
|
1145 |
|
|
copies of this License in the various documents with a single copy
|
1146 |
|
|
that is included in the collection, provided that you follow the
|
1147 |
|
|
rules of this License for verbatim copying of each of the
|
1148 |
|
|
documents in all other respects.
|
1149 |
|
|
|
1150 |
|
|
You may extract a single document from such a collection, and
|
1151 |
|
|
distribute it individually under this License, provided you insert
|
1152 |
|
|
a copy of this License into the extracted document, and follow
|
1153 |
|
|
this License in all other respects regarding verbatim copying of
|
1154 |
|
|
that document.
|
1155 |
|
|
|
1156 |
|
|
7. AGGREGATION WITH INDEPENDENT WORKS
|
1157 |
|
|
|
1158 |
|
|
A compilation of the Document or its derivatives with other
|
1159 |
|
|
separate and independent documents or works, in or on a volume of
|
1160 |
|
|
a storage or distribution medium, is called an "aggregate" if the
|
1161 |
|
|
copyright resulting from the compilation is not used to limit the
|
1162 |
|
|
legal rights of the compilation's users beyond what the individual
|
1163 |
|
|
works permit. When the Document is included in an aggregate, this
|
1164 |
|
|
License does not apply to the other works in the aggregate which
|
1165 |
|
|
are not themselves derivative works of the Document.
|
1166 |
|
|
|
1167 |
|
|
If the Cover Text requirement of section 3 is applicable to these
|
1168 |
|
|
copies of the Document, then if the Document is less than one half
|
1169 |
|
|
of the entire aggregate, the Document's Cover Texts may be placed
|
1170 |
|
|
on covers that bracket the Document within the aggregate, or the
|
1171 |
|
|
electronic equivalent of covers if the Document is in electronic
|
1172 |
|
|
form. Otherwise they must appear on printed covers that bracket
|
1173 |
|
|
the whole aggregate.
|
1174 |
|
|
|
1175 |
|
|
8. TRANSLATION
|
1176 |
|
|
|
1177 |
|
|
Translation is considered a kind of modification, so you may
|
1178 |
|
|
distribute translations of the Document under the terms of section
|
1179 |
|
|
4. Replacing Invariant Sections with translations requires special
|
1180 |
|
|
permission from their copyright holders, but you may include
|
1181 |
|
|
translations of some or all Invariant Sections in addition to the
|
1182 |
|
|
original versions of these Invariant Sections. You may include a
|
1183 |
|
|
translation of this License, and all the license notices in the
|
1184 |
|
|
Document, and any Warranty Disclaimers, provided that you also
|
1185 |
|
|
include the original English version of this License and the
|
1186 |
|
|
original versions of those notices and disclaimers. In case of a
|
1187 |
|
|
disagreement between the translation and the original version of
|
1188 |
|
|
this License or a notice or disclaimer, the original version will
|
1189 |
|
|
prevail.
|
1190 |
|
|
|
1191 |
|
|
If a section in the Document is Entitled "Acknowledgements",
|
1192 |
|
|
"Dedications", or "History", the requirement (section 4) to
|
1193 |
|
|
Preserve its Title (section 1) will typically require changing the
|
1194 |
|
|
actual title.
|
1195 |
|
|
|
1196 |
|
|
9. TERMINATION
|
1197 |
|
|
|
1198 |
|
|
You may not copy, modify, sublicense, or distribute the Document
|
1199 |
|
|
except as expressly provided for under this License. Any other
|
1200 |
|
|
attempt to copy, modify, sublicense or distribute the Document is
|
1201 |
|
|
void, and will automatically terminate your rights under this
|
1202 |
|
|
License. However, parties who have received copies, or rights,
|
1203 |
|
|
from you under this License will not have their licenses
|
1204 |
|
|
terminated so long as such parties remain in full compliance.
|
1205 |
|
|
|
1206 |
|
|
10. FUTURE REVISIONS OF THIS LICENSE
|
1207 |
|
|
|
1208 |
|
|
The Free Software Foundation may publish new, revised versions of
|
1209 |
|
|
the GNU Free Documentation License from time to time. Such new
|
1210 |
|
|
versions will be similar in spirit to the present version, but may
|
1211 |
|
|
differ in detail to address new problems or concerns. See
|
1212 |
|
|
`http://www.gnu.org/copyleft/'.
|
1213 |
|
|
|
1214 |
|
|
Each version of the License is given a distinguishing version
|
1215 |
|
|
number. If the Document specifies that a particular numbered
|
1216 |
|
|
version of this License "or any later version" applies to it, you
|
1217 |
|
|
have the option of following the terms and conditions either of
|
1218 |
|
|
that specified version or of any later version that has been
|
1219 |
|
|
published (not as a draft) by the Free Software Foundation. If
|
1220 |
|
|
the Document does not specify a version number of this License,
|
1221 |
|
|
you may choose any version ever published (not as a draft) by the
|
1222 |
|
|
Free Software Foundation.
|
1223 |
|
|
|
1224 |
|
|
ADDENDUM: How to use this License for your documents
|
1225 |
|
|
====================================================
|
1226 |
|
|
|
1227 |
|
|
To use this License in a document you have written, include a copy of
|
1228 |
|
|
the License in the document and put the following copyright and license
|
1229 |
|
|
notices just after the title page:
|
1230 |
|
|
|
1231 |
|
|
Copyright (C) YEAR YOUR NAME.
|
1232 |
|
|
Permission is granted to copy, distribute and/or modify this document
|
1233 |
|
|
under the terms of the GNU Free Documentation License, Version 1.2
|
1234 |
|
|
or any later version published by the Free Software Foundation;
|
1235 |
|
|
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
|
1236 |
|
|
Texts. A copy of the license is included in the section entitled ``GNU
|
1237 |
|
|
Free Documentation License''.
|
1238 |
|
|
|
1239 |
|
|
If you have Invariant Sections, Front-Cover Texts and Back-Cover
|
1240 |
|
|
Texts, replace the "with...Texts." line with this:
|
1241 |
|
|
|
1242 |
|
|
with the Invariant Sections being LIST THEIR TITLES, with
|
1243 |
|
|
the Front-Cover Texts being LIST, and with the Back-Cover Texts
|
1244 |
|
|
being LIST.
|
1245 |
|
|
|
1246 |
|
|
If you have Invariant Sections without Cover Texts, or some other
|
1247 |
|
|
combination of the three, merge those two alternatives to suit the
|
1248 |
|
|
situation.
|
1249 |
|
|
|
1250 |
|
|
If your document contains nontrivial examples of program code, we
|
1251 |
|
|
recommend releasing these examples in parallel under your choice of
|
1252 |
|
|
free software license, such as the GNU General Public License, to
|
1253 |
|
|
permit their use in free software.
|
1254 |
|
|
|
1255 |
|
|
|
1256 |
|
|
File: gcj.info, Node: Invoking gcj, Next: Compatibility, Prev: GNU Free Documentation License, Up: Top
|
1257 |
|
|
|
1258 |
|
|
1 Invoking gcj
|
1259 |
|
|
**************
|
1260 |
|
|
|
1261 |
|
|
As `gcj' is just another front end to `gcc', it supports many of the
|
1262 |
|
|
same options as gcc. *Note Option Summary: (gcc)Option Summary. This
|
1263 |
|
|
manual only documents the options specific to `gcj'.
|
1264 |
|
|
|
1265 |
|
|
* Menu:
|
1266 |
|
|
|
1267 |
|
|
* Input and output files::
|
1268 |
|
|
* Input Options:: How gcj finds files
|
1269 |
|
|
* Encodings:: Options controlling source file encoding
|
1270 |
|
|
* Warnings:: Options controlling warnings specific to gcj
|
1271 |
|
|
* Linking:: Options for making an executable
|
1272 |
|
|
* Code Generation:: Options controlling the output of gcj
|
1273 |
|
|
* Configure-time Options:: Options you won't use
|
1274 |
|
|
|
1275 |
|
|
|
1276 |
|
|
File: gcj.info, Node: Input and output files, Next: Input Options, Up: Invoking gcj
|
1277 |
|
|
|
1278 |
|
|
1.1 Input and output files
|
1279 |
|
|
==========================
|
1280 |
|
|
|
1281 |
|
|
A `gcj' command is like a `gcc' command, in that it consists of a
|
1282 |
|
|
number of options and file names. The following kinds of input file
|
1283 |
|
|
names are supported:
|
1284 |
|
|
|
1285 |
|
|
`FILE.java'
|
1286 |
|
|
Java source files.
|
1287 |
|
|
|
1288 |
|
|
`FILE.class'
|
1289 |
|
|
Java bytecode files.
|
1290 |
|
|
|
1291 |
|
|
`FILE.zip'
|
1292 |
|
|
`FILE.jar'
|
1293 |
|
|
An archive containing one or more `.class' files, all of which are
|
1294 |
|
|
compiled. The archive may be compressed. Files in an archive
|
1295 |
|
|
which don't end with `.class' are treated as resource files; they
|
1296 |
|
|
are compiled into the resulting object file as `core:' URLs.
|
1297 |
|
|
|
1298 |
|
|
`@FILE'
|
1299 |
|
|
A file containing a whitespace-separated list of input file names.
|
1300 |
|
|
(Currently, these must all be `.java' source files, but that may
|
1301 |
|
|
change.) Each named file is compiled, just as if it had been on
|
1302 |
|
|
the command line.
|
1303 |
|
|
|
1304 |
|
|
`LIBRARY.a'
|
1305 |
|
|
`LIBRARY.so'
|
1306 |
|
|
`-lLIBNAME'
|
1307 |
|
|
Libraries to use when linking. See the `gcc' manual.
|
1308 |
|
|
|
1309 |
|
|
You can specify more than one input file on the `gcj' command line,
|
1310 |
|
|
in which case they will all be compiled. If you specify a `-o FILENAME'
|
1311 |
|
|
option, all the input files will be compiled together, producing a
|
1312 |
|
|
single output file, named FILENAME. This is allowed even when using
|
1313 |
|
|
`-S' or `-c', but not when using `-C' or `--resource'. (This is an
|
1314 |
|
|
extension beyond the what plain `gcc' allows.) (If more than one input
|
1315 |
|
|
file is specified, all must currently be `.java' files, though we hope
|
1316 |
|
|
to fix this.)
|
1317 |
|
|
|
1318 |
|
|
|
1319 |
|
|
File: gcj.info, Node: Input Options, Next: Encodings, Prev: Input and output files, Up: Invoking gcj
|
1320 |
|
|
|
1321 |
|
|
1.2 Input Options
|
1322 |
|
|
=================
|
1323 |
|
|
|
1324 |
|
|
`gcj' has options to control where it looks to find files it needs.
|
1325 |
|
|
For instance, `gcj' might need to load a class that is referenced by
|
1326 |
|
|
the file it has been asked to compile. Like other compilers for the
|
1327 |
|
|
Java language, `gcj' has a notion of a "class path". There are several
|
1328 |
|
|
options and environment variables which can be used to manipulate the
|
1329 |
|
|
class path. When `gcj' looks for a given class, it searches the class
|
1330 |
|
|
path looking for matching `.class' or `.java' file. `gcj' comes with a
|
1331 |
|
|
built-in class path which points at the installed `libgcj.jar', a file
|
1332 |
|
|
which contains all the standard classes.
|
1333 |
|
|
|
1334 |
|
|
In the text below, a directory or path component can refer either to
|
1335 |
|
|
an actual directory on the filesystem, or to a `.zip' or `.jar' file,
|
1336 |
|
|
which `gcj' will search as if it is a directory.
|
1337 |
|
|
|
1338 |
|
|
`-IDIR'
|
1339 |
|
|
All directories specified by `-I' are kept in order and prepended
|
1340 |
|
|
to the class path constructed from all the other options. Unless
|
1341 |
|
|
compatibility with tools like `javac' is important, we recommend
|
1342 |
|
|
always using `-I' instead of the other options for manipulating the
|
1343 |
|
|
class path.
|
1344 |
|
|
|
1345 |
|
|
`--classpath=PATH'
|
1346 |
|
|
This sets the class path to PATH, a colon-separated list of paths
|
1347 |
|
|
(on Windows-based systems, a semicolon-separate list of paths).
|
1348 |
|
|
This does not override the builtin ("boot") search path.
|
1349 |
|
|
|
1350 |
|
|
`--CLASSPATH=PATH'
|
1351 |
|
|
Deprecated synonym for `--classpath'.
|
1352 |
|
|
|
1353 |
|
|
`--bootclasspath=PATH'
|
1354 |
|
|
Where to find the standard builtin classes, such as
|
1355 |
|
|
`java.lang.String'.
|
1356 |
|
|
|
1357 |
|
|
`--extdirs=PATH'
|
1358 |
|
|
For each directory in the PATH, place the contents of that
|
1359 |
|
|
directory at the end of the class path.
|
1360 |
|
|
|
1361 |
|
|
`CLASSPATH'
|
1362 |
|
|
This is an environment variable which holds a list of paths.
|
1363 |
|
|
|
1364 |
|
|
The final class path is constructed like so:
|
1365 |
|
|
|
1366 |
|
|
* First come all directories specified via `-I'.
|
1367 |
|
|
|
1368 |
|
|
* If `--classpath' is specified, its value is appended. Otherwise,
|
1369 |
|
|
if the `CLASSPATH' environment variable is specified, then its
|
1370 |
|
|
value is appended. Otherwise, the current directory (`"."') is
|
1371 |
|
|
appended.
|
1372 |
|
|
|
1373 |
|
|
* If `--bootclasspath' was specified, append its value. Otherwise,
|
1374 |
|
|
append the built-in system directory, `libgcj.jar'.
|
1375 |
|
|
|
1376 |
|
|
* Finally, if `--extdirs' was specified, append the contents of the
|
1377 |
|
|
specified directories at the end of the class path. Otherwise,
|
1378 |
|
|
append the contents of the built-in extdirs at
|
1379 |
|
|
`$(prefix)/share/java/ext'.
|
1380 |
|
|
|
1381 |
|
|
The classfile built by `gcj' for the class `java.lang.Object' (and
|
1382 |
|
|
placed in `libgcj.jar') contains a special zero length attribute
|
1383 |
|
|
`gnu.gcj.gcj-compiled'. The compiler looks for this attribute when
|
1384 |
|
|
loading `java.lang.Object' and will report an error if it isn't found,
|
1385 |
|
|
unless it compiles to bytecode (the option
|
1386 |
|
|
`-fforce-classes-archive-check' can be used to override this behavior
|
1387 |
|
|
in this particular case.)
|
1388 |
|
|
|
1389 |
|
|
`-fforce-classes-archive-check'
|
1390 |
|
|
This forces the compiler to always check for the special zero
|
1391 |
|
|
length attribute `gnu.gcj.gcj-compiled' in `java.lang.Object' and
|
1392 |
|
|
issue an error if it isn't found.
|
1393 |
|
|
|
1394 |
|
|
`-fsource=VERSION'
|
1395 |
|
|
This option is used to choose the source version accepted by
|
1396 |
|
|
`gcj'. The default is `1.5'.
|
1397 |
|
|
|
1398 |
|
|
|
1399 |
|
|
File: gcj.info, Node: Encodings, Next: Warnings, Prev: Input Options, Up: Invoking gcj
|
1400 |
|
|
|
1401 |
|
|
1.3 Encodings
|
1402 |
|
|
=============
|
1403 |
|
|
|
1404 |
|
|
The Java programming language uses Unicode throughout. In an effort to
|
1405 |
|
|
integrate well with other locales, `gcj' allows `.java' files to be
|
1406 |
|
|
written using almost any encoding. `gcj' knows how to convert these
|
1407 |
|
|
encodings into its internal encoding at compile time.
|
1408 |
|
|
|
1409 |
|
|
You can use the `--encoding=NAME' option to specify an encoding (of
|
1410 |
|
|
a particular character set) to use for source files. If this is not
|
1411 |
|
|
specified, the default encoding comes from your current locale. If
|
1412 |
|
|
your host system has insufficient locale support, then `gcj' assumes
|
1413 |
|
|
the default encoding to be the `UTF-8' encoding of Unicode.
|
1414 |
|
|
|
1415 |
|
|
To implement `--encoding', `gcj' simply uses the host platform's
|
1416 |
|
|
`iconv' conversion routine. This means that in practice `gcj' is
|
1417 |
|
|
limited by the capabilities of the host platform.
|
1418 |
|
|
|
1419 |
|
|
The names allowed for the argument `--encoding' vary from platform
|
1420 |
|
|
to platform (since they are not standardized anywhere). However, `gcj'
|
1421 |
|
|
implements the encoding named `UTF-8' internally, so if you choose to
|
1422 |
|
|
use this for your source files you can be assured that it will work on
|
1423 |
|
|
every host.
|
1424 |
|
|
|
1425 |
|
|
|
1426 |
|
|
File: gcj.info, Node: Warnings, Next: Linking, Prev: Encodings, Up: Invoking gcj
|
1427 |
|
|
|
1428 |
|
|
1.4 Warnings
|
1429 |
|
|
============
|
1430 |
|
|
|
1431 |
|
|
`gcj' implements several warnings. As with other generic `gcc'
|
1432 |
|
|
warnings, if an option of the form `-Wfoo' enables a warning, then
|
1433 |
|
|
`-Wno-foo' will disable it. Here we've chosen to document the form of
|
1434 |
|
|
the warning which will have an effect - the default being the opposite
|
1435 |
|
|
of what is listed.
|
1436 |
|
|
|
1437 |
|
|
`-Wredundant-modifiers'
|
1438 |
|
|
With this flag, `gcj' will warn about redundant modifiers. For
|
1439 |
|
|
instance, it will warn if an interface method is declared `public'.
|
1440 |
|
|
|
1441 |
|
|
`-Wextraneous-semicolon'
|
1442 |
|
|
This causes `gcj' to warn about empty statements. Empty statements
|
1443 |
|
|
have been deprecated.
|
1444 |
|
|
|
1445 |
|
|
`-Wno-out-of-date'
|
1446 |
|
|
This option will cause `gcj' not to warn when a source file is
|
1447 |
|
|
newer than its matching class file. By default `gcj' will warn
|
1448 |
|
|
about this.
|
1449 |
|
|
|
1450 |
|
|
`-Wno-deprecated'
|
1451 |
|
|
Warn if a deprecated class, method, or field is referred to.
|
1452 |
|
|
|
1453 |
|
|
`-Wunused'
|
1454 |
|
|
This is the same as `gcc''s `-Wunused'.
|
1455 |
|
|
|
1456 |
|
|
`-Wall'
|
1457 |
|
|
This is the same as `-Wredundant-modifiers -Wextraneous-semicolon
|
1458 |
|
|
-Wunused'.
|
1459 |
|
|
|
1460 |
|
|
|
1461 |
|
|
File: gcj.info, Node: Linking, Next: Code Generation, Prev: Warnings, Up: Invoking gcj
|
1462 |
|
|
|
1463 |
|
|
1.5 Linking
|
1464 |
|
|
===========
|
1465 |
|
|
|
1466 |
|
|
To turn a Java application into an executable program, you need to link
|
1467 |
|
|
it with the needed libraries, just as for C or C++. The linker by
|
1468 |
|
|
default looks for a global function named `main'. Since Java does not
|
1469 |
|
|
have global functions, and a collection of Java classes may have more
|
1470 |
|
|
than one class with a `main' method, you need to let the linker know
|
1471 |
|
|
which of those `main' methods it should invoke when starting the
|
1472 |
|
|
application. You can do that in any of these ways:
|
1473 |
|
|
|
1474 |
|
|
* Specify the class containing the desired `main' method when you
|
1475 |
|
|
link the application, using the `--main' flag, described below.
|
1476 |
|
|
|
1477 |
|
|
* Link the Java package(s) into a shared library (dll) rather than an
|
1478 |
|
|
executable. Then invoke the application using the `gij' program,
|
1479 |
|
|
making sure that `gij' can find the libraries it needs.
|
1480 |
|
|
|
1481 |
|
|
* Link the Java packages(s) with the flag `-lgij', which links in
|
1482 |
|
|
the `main' routine from the `gij' command. This allows you to
|
1483 |
|
|
select the class whose `main' method you want to run when you run
|
1484 |
|
|
the application. You can also use other `gij' flags, such as `-D'
|
1485 |
|
|
flags to set properties. Using the `-lgij' library (rather than
|
1486 |
|
|
the `gij' program of the previous mechanism) has some advantages:
|
1487 |
|
|
it is compatible with static linking, and does not require
|
1488 |
|
|
configuring or installing libraries.
|
1489 |
|
|
|
1490 |
|
|
These `gij' options relate to linking an executable:
|
1491 |
|
|
|
1492 |
|
|
`--main=CLASSNAME'
|
1493 |
|
|
This option is used when linking to specify the name of the class
|
1494 |
|
|
whose `main' method should be invoked when the resulting
|
1495 |
|
|
executable is run.
|
1496 |
|
|
|
1497 |
|
|
`-DNAME[=VALUE]'
|
1498 |
|
|
This option can only be used with `--main'. It defines a system
|
1499 |
|
|
property named NAME with value VALUE. If VALUE is not specified
|
1500 |
|
|
then it defaults to the empty string. These system properties are
|
1501 |
|
|
initialized at the program's startup and can be retrieved at
|
1502 |
|
|
runtime using the `java.lang.System.getProperty' method.
|
1503 |
|
|
|
1504 |
|
|
`-lgij'
|
1505 |
|
|
Create an application whose command-line processing is that of the
|
1506 |
|
|
`gij' command.
|
1507 |
|
|
|
1508 |
|
|
This option is an alternative to using `--main'; you cannot use
|
1509 |
|
|
both.
|
1510 |
|
|
|
1511 |
|
|
`-static-libgcj'
|
1512 |
|
|
This option causes linking to be done against a static version of
|
1513 |
|
|
the libgcj runtime library. This option is only available if
|
1514 |
|
|
corresponding linker support exists.
|
1515 |
|
|
|
1516 |
|
|
*Caution:* Static linking of libgcj may cause essential parts of
|
1517 |
|
|
libgcj to be omitted. Some parts of libgcj use reflection to load
|
1518 |
|
|
classes at runtime. Since the linker does not see these
|
1519 |
|
|
references at link time, it can omit the referred to classes. The
|
1520 |
|
|
result is usually (but not always) a `ClassNotFoundException'
|
1521 |
|
|
being thrown at runtime. Caution must be used when using this
|
1522 |
|
|
option. For more details see:
|
1523 |
|
|
`http://gcc.gnu.org/wiki/Statically%20linking%20libgcj'
|
1524 |
|
|
|
1525 |
|
|
|
1526 |
|
|
File: gcj.info, Node: Code Generation, Next: Configure-time Options, Prev: Linking, Up: Invoking gcj
|
1527 |
|
|
|
1528 |
|
|
1.6 Code Generation
|
1529 |
|
|
===================
|
1530 |
|
|
|
1531 |
|
|
In addition to the many `gcc' options controlling code generation,
|
1532 |
|
|
`gcj' has several options specific to itself.
|
1533 |
|
|
|
1534 |
|
|
`-C'
|
1535 |
|
|
This option is used to tell `gcj' to generate bytecode (`.class'
|
1536 |
|
|
files) rather than object code.
|
1537 |
|
|
|
1538 |
|
|
`--resource RESOURCE-NAME'
|
1539 |
|
|
This option is used to tell `gcj' to compile the contents of a
|
1540 |
|
|
given file to object code so it may be accessed at runtime with
|
1541 |
|
|
the core protocol handler as `core:/RESOURCE-NAME'. Note that
|
1542 |
|
|
RESOURCE-NAME is the name of the resource as found at runtime; for
|
1543 |
|
|
instance, it could be used in a call to `ResourceBundle.getBundle'.
|
1544 |
|
|
The actual file name to be compiled this way must be specified
|
1545 |
|
|
separately.
|
1546 |
|
|
|
1547 |
|
|
`-ftarget=VERSION'
|
1548 |
|
|
This can be used with `-C' to choose the version of bytecode
|
1549 |
|
|
emitted by `gcj'. The default is `1.5'. When not generating
|
1550 |
|
|
bytecode, this option has no effect.
|
1551 |
|
|
|
1552 |
|
|
`-d DIRECTORY'
|
1553 |
|
|
When used with `-C', this causes all generated `.class' files to
|
1554 |
|
|
be put in the appropriate subdirectory of DIRECTORY. By default
|
1555 |
|
|
they will be put in subdirectories of the current working
|
1556 |
|
|
directory.
|
1557 |
|
|
|
1558 |
|
|
`-fno-bounds-check'
|
1559 |
|
|
By default, `gcj' generates code which checks the bounds of all
|
1560 |
|
|
array indexing operations. With this option, these checks are
|
1561 |
|
|
omitted, which can improve performance for code that uses arrays
|
1562 |
|
|
extensively. Note that this can result in unpredictable behavior
|
1563 |
|
|
if the code in question actually does violate array bounds
|
1564 |
|
|
constraints. It is safe to use this option if you are sure that
|
1565 |
|
|
your code will never throw an `ArrayIndexOutOfBoundsException'.
|
1566 |
|
|
|
1567 |
|
|
`-fno-store-check'
|
1568 |
|
|
Don't generate array store checks. When storing objects into
|
1569 |
|
|
arrays, a runtime check is normally generated in order to ensure
|
1570 |
|
|
that the object is assignment compatible with the component type
|
1571 |
|
|
of the array (which may not be known at compile-time). With this
|
1572 |
|
|
option, these checks are omitted. This can improve performance
|
1573 |
|
|
for code which stores objects into arrays frequently. It is safe
|
1574 |
|
|
to use this option if you are sure your code will never throw an
|
1575 |
|
|
`ArrayStoreException'.
|
1576 |
|
|
|
1577 |
|
|
`-fjni'
|
1578 |
|
|
With `gcj' there are two options for writing native methods: CNI
|
1579 |
|
|
and JNI. By default `gcj' assumes you are using CNI. If you are
|
1580 |
|
|
compiling a class with native methods, and these methods are
|
1581 |
|
|
implemented using JNI, then you must use `-fjni'. This option
|
1582 |
|
|
causes `gcj' to generate stubs which will invoke the underlying JNI
|
1583 |
|
|
methods.
|
1584 |
|
|
|
1585 |
|
|
`-fno-assert'
|
1586 |
|
|
Don't recognize the `assert' keyword. This is for compatibility
|
1587 |
|
|
with older versions of the language specification.
|
1588 |
|
|
|
1589 |
|
|
`-fno-optimize-static-class-initialization'
|
1590 |
|
|
When the optimization level is greater or equal to `-O2', `gcj'
|
1591 |
|
|
will try to optimize the way calls into the runtime are made to
|
1592 |
|
|
initialize static classes upon their first use (this optimization
|
1593 |
|
|
isn't carried out if `-C' was specified.) When compiling to native
|
1594 |
|
|
code, `-fno-optimize-static-class-initialization' will turn this
|
1595 |
|
|
optimization off, regardless of the optimization level in use.
|
1596 |
|
|
|
1597 |
|
|
`--disable-assertions[=CLASS-OR-PACKAGE]'
|
1598 |
|
|
Don't include code for checking assertions in the compiled code.
|
1599 |
|
|
If `=CLASS-OR-PACKAGE' is missing disables assertion code
|
1600 |
|
|
generation for all classes, unless overridden by a more specific
|
1601 |
|
|
`--enable-assertions' flag. If CLASS-OR-PACKAGE is a class name,
|
1602 |
|
|
only disables generating assertion checks within the named class
|
1603 |
|
|
or its inner classes. If CLASS-OR-PACKAGE is a package name,
|
1604 |
|
|
disables generating assertion checks within the named package or a
|
1605 |
|
|
subpackage.
|
1606 |
|
|
|
1607 |
|
|
By default, assertions are enabled when generating class files or
|
1608 |
|
|
when not optimizing, and disabled when generating optimized
|
1609 |
|
|
binaries.
|
1610 |
|
|
|
1611 |
|
|
`--enable-assertions[=CLASS-OR-PACKAGE]'
|
1612 |
|
|
Generates code to check assertions. The option is perhaps
|
1613 |
|
|
misnamed, as you still need to turn on assertion checking at
|
1614 |
|
|
run-time, and we don't support any easy way to do that. So this
|
1615 |
|
|
flag isn't very useful yet, except to partially override
|
1616 |
|
|
`--disable-assertions'.
|
1617 |
|
|
|
1618 |
|
|
`-findirect-dispatch'
|
1619 |
|
|
`gcj' has a special binary compatibility ABI, which is enabled by
|
1620 |
|
|
the `-findirect-dispatch' option. In this mode, the code
|
1621 |
|
|
generated by `gcj' honors the binary compatibility guarantees in
|
1622 |
|
|
the Java Language Specification, and the resulting object files do
|
1623 |
|
|
not need to be directly linked against their dependencies.
|
1624 |
|
|
Instead, all dependencies are looked up at runtime. This allows
|
1625 |
|
|
free mixing of interpreted and compiled code.
|
1626 |
|
|
|
1627 |
|
|
Note that, at present, `-findirect-dispatch' can only be used when
|
1628 |
|
|
compiling `.class' files. It will not work when compiling from
|
1629 |
|
|
source. CNI also does not yet work with the binary compatibility
|
1630 |
|
|
ABI. These restrictions will be lifted in some future release.
|
1631 |
|
|
|
1632 |
|
|
However, if you compile CNI code with the standard ABI, you can
|
1633 |
|
|
call it from code built with the binary compatibility ABI.
|
1634 |
|
|
|
1635 |
|
|
`-fbootstrap-classes'
|
1636 |
|
|
This option can be use to tell `libgcj' that the compiled classes
|
1637 |
|
|
should be loaded by the bootstrap loader, not the system class
|
1638 |
|
|
loader. By default, if you compile a class and link it into an
|
1639 |
|
|
executable, it will be treated as if it was loaded using the
|
1640 |
|
|
system class loader. This is convenient, as it means that things
|
1641 |
|
|
like `Class.forName()' will search `CLASSPATH' to find the desired
|
1642 |
|
|
class.
|
1643 |
|
|
|
1644 |
|
|
`-freduced-reflection'
|
1645 |
|
|
This option causes the code generated by `gcj' to contain a
|
1646 |
|
|
reduced amount of the class meta-data used to support runtime
|
1647 |
|
|
reflection. The cost of this savings is the loss of the ability to
|
1648 |
|
|
use certain reflection capabilities of the standard Java runtime
|
1649 |
|
|
environment. When set all meta-data except for that which is
|
1650 |
|
|
needed to obtain correct runtime semantics is eliminated.
|
1651 |
|
|
|
1652 |
|
|
For code that does not use reflection (i.e. serialization, RMI,
|
1653 |
|
|
CORBA or call methods in the `java.lang.reflect' package),
|
1654 |
|
|
`-freduced-reflection' will result in proper operation with a
|
1655 |
|
|
savings in executable code size.
|
1656 |
|
|
|
1657 |
|
|
JNI (`-fjni') and the binary compatibility ABI
|
1658 |
|
|
(`-findirect-dispatch') do not work properly without full
|
1659 |
|
|
reflection meta-data. Because of this, it is an error to use
|
1660 |
|
|
these options with `-freduced-reflection'.
|
1661 |
|
|
|
1662 |
|
|
*Caution:* If there is no reflection meta-data, code that uses a
|
1663 |
|
|
`SecurityManager' may not work properly. Also calling
|
1664 |
|
|
`Class.forName()' may fail if the calling method has no reflection
|
1665 |
|
|
meta-data.
|
1666 |
|
|
|
1667 |
|
|
|
1668 |
|
|
|
1669 |
|
|
File: gcj.info, Node: Configure-time Options, Prev: Code Generation, Up: Invoking gcj
|
1670 |
|
|
|
1671 |
|
|
1.7 Configure-time Options
|
1672 |
|
|
==========================
|
1673 |
|
|
|
1674 |
|
|
Some `gcj' code generations options affect the resulting ABI, and so
|
1675 |
|
|
can only be meaningfully given when `libgcj', the runtime package, is
|
1676 |
|
|
configured. `libgcj' puts the appropriate options from this group into
|
1677 |
|
|
a `spec' file which is read by `gcj'. These options are listed here
|
1678 |
|
|
for completeness; if you are using `libgcj' then you won't want to
|
1679 |
|
|
touch these options.
|
1680 |
|
|
|
1681 |
|
|
`-fuse-boehm-gc'
|
1682 |
|
|
This enables the use of the Boehm GC bitmap marking code. In
|
1683 |
|
|
particular this causes `gcj' to put an object marking descriptor
|
1684 |
|
|
into each vtable.
|
1685 |
|
|
|
1686 |
|
|
`-fhash-synchronization'
|
1687 |
|
|
By default, synchronization data (the data used for `synchronize',
|
1688 |
|
|
`wait', and `notify') is pointed to by a word in each object.
|
1689 |
|
|
With this option `gcj' assumes that this information is stored in a
|
1690 |
|
|
hash table and not in the object itself.
|
1691 |
|
|
|
1692 |
|
|
`-fuse-divide-subroutine'
|
1693 |
|
|
On some systems, a library routine is called to perform integer
|
1694 |
|
|
division. This is required to get exception handling correct when
|
1695 |
|
|
dividing by zero.
|
1696 |
|
|
|
1697 |
|
|
`-fcheck-references'
|
1698 |
|
|
On some systems it's necessary to insert inline checks whenever
|
1699 |
|
|
accessing an object via a reference. On other systems you won't
|
1700 |
|
|
need this because null pointer accesses are caught automatically
|
1701 |
|
|
by the processor.
|
1702 |
|
|
|
1703 |
|
|
`-fuse-atomic-builtins'
|
1704 |
|
|
On some systems, gcc can generate code for built-in atomic
|
1705 |
|
|
operations. Use this option to force gcj to use these builtins
|
1706 |
|
|
when compiling Java code. Where this capability is present it
|
1707 |
|
|
should be automatically detected, so you won't usually need to use
|
1708 |
|
|
this option.
|
1709 |
|
|
|
1710 |
|
|
|
1711 |
|
|
|
1712 |
|
|
File: gcj.info, Node: Compatibility, Next: Invoking jcf-dump, Prev: Invoking gcj, Up: Top
|
1713 |
|
|
|
1714 |
|
|
2 Compatibility with the Java Platform
|
1715 |
|
|
**************************************
|
1716 |
|
|
|
1717 |
|
|
As we believe it is important that the Java platform not be fragmented,
|
1718 |
|
|
`gcj' and `libgcj' try to conform to the relevant Java specifications.
|
1719 |
|
|
However, limited manpower and incomplete and unclear documentation work
|
1720 |
|
|
against us. So, there are caveats to using `gcj'.
|
1721 |
|
|
|
1722 |
|
|
* Menu:
|
1723 |
|
|
|
1724 |
|
|
* Limitations::
|
1725 |
|
|
* Extensions::
|
1726 |
|
|
|
1727 |
|
|
|
1728 |
|
|
File: gcj.info, Node: Limitations, Next: Extensions, Up: Compatibility
|
1729 |
|
|
|
1730 |
|
|
2.1 Standard features not yet supported
|
1731 |
|
|
=======================================
|
1732 |
|
|
|
1733 |
|
|
This list of compatibility issues is by no means complete.
|
1734 |
|
|
|
1735 |
|
|
* `gcj' implements the JDK 1.2 language. It supports inner classes
|
1736 |
|
|
and the new 1.4 `assert' keyword. It does not yet support the
|
1737 |
|
|
Java 2 `strictfp' keyword (it recognizes the keyword but ignores
|
1738 |
|
|
it).
|
1739 |
|
|
|
1740 |
|
|
* `libgcj' is largely compatible with the JDK 1.2 libraries.
|
1741 |
|
|
However, `libgcj' is missing many packages, most notably
|
1742 |
|
|
`java.awt'. There are also individual missing classes and methods.
|
1743 |
|
|
We currently do not have a list showing differences between
|
1744 |
|
|
`libgcj' and the Java 2 platform.
|
1745 |
|
|
|
1746 |
|
|
* Sometimes the `libgcj' implementation of a method or class differs
|
1747 |
|
|
from the JDK implementation. This is not always a bug. Still, if
|
1748 |
|
|
it affects you, it probably makes sense to report it so that we
|
1749 |
|
|
can discuss the appropriate response.
|
1750 |
|
|
|
1751 |
|
|
* `gcj' does not currently allow for piecemeal replacement of
|
1752 |
|
|
components within `libgcj'. Unfortunately, programmers often want
|
1753 |
|
|
to use newer versions of certain packages, such as those provided
|
1754 |
|
|
by the Apache Software Foundation's Jakarta project. This has
|
1755 |
|
|
forced us to place the `org.w3c.dom' and `org.xml.sax' packages
|
1756 |
|
|
into their own libraries, separate from `libgcj'. If you intend to
|
1757 |
|
|
use these classes, you must link them explicitly with
|
1758 |
|
|
`-l-org-w3c-dom' and `-l-org-xml-sax'. Future versions of `gcj'
|
1759 |
|
|
may not have this restriction.
|
1760 |
|
|
|
1761 |
|
|
|
1762 |
|
|
File: gcj.info, Node: Extensions, Prev: Limitations, Up: Compatibility
|
1763 |
|
|
|
1764 |
|
|
2.2 Extra features unique to gcj
|
1765 |
|
|
================================
|
1766 |
|
|
|
1767 |
|
|
The main feature of `gcj' is that it can compile programs written in
|
1768 |
|
|
the Java programming language to native code. Most extensions that
|
1769 |
|
|
have been added are to facilitate this functionality.
|
1770 |
|
|
|
1771 |
|
|
* `gcj' makes it easy and efficient to mix code written in Java and
|
1772 |
|
|
C++. *Note About CNI::, for more info on how to use this in your
|
1773 |
|
|
programs.
|
1774 |
|
|
|
1775 |
|
|
* When you compile your classes into a shared library using
|
1776 |
|
|
`-findirect-dispatch' then add them to the system-wide classmap.db
|
1777 |
|
|
file using `gcj-dbtool', they will be automatically loaded by the
|
1778 |
|
|
`libgcj' system classloader. This is the new, preferred
|
1779 |
|
|
classname-to-library resolution mechanism. *Note Invoking
|
1780 |
|
|
gcj-dbtool::, for more information on using the classmap database.
|
1781 |
|
|
|
1782 |
|
|
* The old classname-to-library lookup mechanism is still supported
|
1783 |
|
|
through the `gnu.gcj.runtime.VMClassLoader.library_control'
|
1784 |
|
|
property, but it is deprecated and will likely be removed in some
|
1785 |
|
|
future release. When trying to load a class `gnu.pkg.SomeClass'
|
1786 |
|
|
the system classloader will first try to load the shared library
|
1787 |
|
|
`lib-gnu-pkg-SomeClass.so', if that fails to load the class then
|
1788 |
|
|
it will try to load `lib-gnu-pkg.so' and finally when the class is
|
1789 |
|
|
still not loaded it will try to load `lib-gnu.so'. Note that all
|
1790 |
|
|
`.'s will be transformed into `-'s and that searching for inner
|
1791 |
|
|
classes starts with their outermost outer class. If the class
|
1792 |
|
|
cannot be found this way the system classloader tries to use the
|
1793 |
|
|
`libgcj' bytecode interpreter to load the class from the standard
|
1794 |
|
|
classpath. This process can be controlled to some degree via the
|
1795 |
|
|
`gnu.gcj.runtime.VMClassLoader.library_control' property; *Note
|
1796 |
|
|
libgcj Runtime Properties::.
|
1797 |
|
|
|
1798 |
|
|
* `libgcj' includes a special `gcjlib' URL type. A URL of this form
|
1799 |
|
|
is like a `jar' URL, and looks like
|
1800 |
|
|
`gcjlib:/path/to/shared/library.so!/path/to/resource'. An access
|
1801 |
|
|
to one of these URLs causes the shared library to be `dlopen()'d,
|
1802 |
|
|
and then the resource is looked for in that library. These URLs
|
1803 |
|
|
are most useful when used in conjunction with
|
1804 |
|
|
`java.net.URLClassLoader'. Note that, due to implementation
|
1805 |
|
|
limitations, currently any such URL can be accessed by only one
|
1806 |
|
|
class loader, and libraries are never unloaded. This means some
|
1807 |
|
|
care must be exercised to make sure that a `gcjlib' URL is not
|
1808 |
|
|
accessed by more than one class loader at once. In a future
|
1809 |
|
|
release this limitation will be lifted, and such libraries will be
|
1810 |
|
|
mapped privately.
|
1811 |
|
|
|
1812 |
|
|
* A program compiled by `gcj' will examine the `GCJ_PROPERTIES'
|
1813 |
|
|
environment variable and change its behavior in some ways. In
|
1814 |
|
|
particular `GCJ_PROPERTIES' holds a list of assignments to global
|
1815 |
|
|
properties, such as would be set with the `-D' option to `java'.
|
1816 |
|
|
For instance, `java.compiler=gcj' is a valid (but currently
|
1817 |
|
|
meaningless) setting.
|
1818 |
|
|
|
1819 |
|
|
|
1820 |
|
|
|
1821 |
|
|
File: gcj.info, Node: Invoking jcf-dump, Next: Invoking gij, Prev: Compatibility, Up: Top
|
1822 |
|
|
|
1823 |
|
|
3 Invoking jcf-dump
|
1824 |
|
|
*******************
|
1825 |
|
|
|
1826 |
|
|
This is a class file examiner, similar to `javap'. It will print
|
1827 |
|
|
information about a number of classes, which are specified by class name
|
1828 |
|
|
or file name.
|
1829 |
|
|
|
1830 |
|
|
`-c'
|
1831 |
|
|
Disassemble method bodies. By default method bodies are not
|
1832 |
|
|
printed.
|
1833 |
|
|
|
1834 |
|
|
`--print-constants'
|
1835 |
|
|
Print the constant pool. When printing a reference to a constant
|
1836 |
|
|
also print its index in the constant pool.
|
1837 |
|
|
|
1838 |
|
|
`--javap'
|
1839 |
|
|
Generate output in `javap' format. The implementation of this
|
1840 |
|
|
feature is very incomplete.
|
1841 |
|
|
|
1842 |
|
|
`--classpath=PATH'
|
1843 |
|
|
`--CLASSPATH=PATH'
|
1844 |
|
|
`-IDIRECTORY'
|
1845 |
|
|
`-o FILE'
|
1846 |
|
|
These options as the same as the corresponding `gcj' options.
|
1847 |
|
|
|
1848 |
|
|
`--help'
|
1849 |
|
|
Print help, then exit.
|
1850 |
|
|
|
1851 |
|
|
`--version'
|
1852 |
|
|
Print version number, then exit.
|
1853 |
|
|
|
1854 |
|
|
`-v, --verbose'
|
1855 |
|
|
Print extra information while running. Implies
|
1856 |
|
|
`--print-constants'.
|
1857 |
|
|
|
1858 |
|
|
|
1859 |
|
|
File: gcj.info, Node: Invoking gij, Next: Invoking gcj-dbtool, Prev: Invoking jcf-dump, Up: Top
|
1860 |
|
|
|
1861 |
|
|
4 Invoking gij
|
1862 |
|
|
**************
|
1863 |
|
|
|
1864 |
|
|
`gij' is a Java bytecode interpreter included with `libgcj'. `gij' is
|
1865 |
|
|
not available on every platform; porting it requires a small amount of
|
1866 |
|
|
assembly programming which has not been done for all the targets
|
1867 |
|
|
supported by `gcj'.
|
1868 |
|
|
|
1869 |
|
|
The primary argument to `gij' is the name of a class or, with
|
1870 |
|
|
`-jar', a jar file. Options before this argument are interpreted by
|
1871 |
|
|
`gij'; remaining options are passed to the interpreted program.
|
1872 |
|
|
|
1873 |
|
|
If a class name is specified and this class does not have a `main'
|
1874 |
|
|
method with the appropriate signature (a `static void' method with a
|
1875 |
|
|
`String[]' as its sole argument), then `gij' will print an error and
|
1876 |
|
|
exit.
|
1877 |
|
|
|
1878 |
|
|
If a jar file is specified then `gij' will use information in it to
|
1879 |
|
|
determine which class' `main' method will be invoked.
|
1880 |
|
|
|
1881 |
|
|
`gij' will invoke the `main' method with all the remaining
|
1882 |
|
|
command-line options.
|
1883 |
|
|
|
1884 |
|
|
Note that `gij' is not limited to interpreting code. Because
|
1885 |
|
|
`libgcj' includes a class loader which can dynamically load shared
|
1886 |
|
|
objects, it is possible to give `gij' the name of a class which has
|
1887 |
|
|
been compiled and put into a shared library on the class path.
|
1888 |
|
|
|
1889 |
|
|
`-cp PATH'
|
1890 |
|
|
`-classpath PATH'
|
1891 |
|
|
Set the initial class path. The class path is used for finding
|
1892 |
|
|
class and resource files. If specified, this option overrides the
|
1893 |
|
|
`CLASSPATH' environment variable. Note that this option is
|
1894 |
|
|
ignored if `-jar' is used.
|
1895 |
|
|
|
1896 |
|
|
`-DNAME[=VALUE]'
|
1897 |
|
|
This defines a system property named NAME with value VALUE. If
|
1898 |
|
|
VALUE is not specified then it defaults to the empty string.
|
1899 |
|
|
These system properties are initialized at the program's startup
|
1900 |
|
|
and can be retrieved at runtime using the
|
1901 |
|
|
`java.lang.System.getProperty' method.
|
1902 |
|
|
|
1903 |
|
|
`-ms=NUMBER'
|
1904 |
|
|
Equivalent to `-Xms'.
|
1905 |
|
|
|
1906 |
|
|
`-mx=NUMBER'
|
1907 |
|
|
Equivalent to `-Xmx'.
|
1908 |
|
|
|
1909 |
|
|
`-noverify'
|
1910 |
|
|
Do not verify compliance of bytecode with the VM specification. In
|
1911 |
|
|
addition, this option disables type verification which is
|
1912 |
|
|
otherwise performed on BC-ABI compiled code.
|
1913 |
|
|
|
1914 |
|
|
`-X'
|
1915 |
|
|
`-XARGUMENT'
|
1916 |
|
|
Supplying `-X' by itself will cause `gij' to list all the
|
1917 |
|
|
supported `-X' options. Currently these options are supported:
|
1918 |
|
|
|
1919 |
|
|
`-XmsSIZE'
|
1920 |
|
|
Set the initial heap size.
|
1921 |
|
|
|
1922 |
|
|
`-XmxSIZE'
|
1923 |
|
|
Set the maximum heap size.
|
1924 |
|
|
|
1925 |
|
|
`-XssSIZE'
|
1926 |
|
|
Set the thread stack size.
|
1927 |
|
|
|
1928 |
|
|
Unrecognized `-X' options are ignored, for compatibility with
|
1929 |
|
|
other runtimes.
|
1930 |
|
|
|
1931 |
|
|
`-jar'
|
1932 |
|
|
This indicates that the name passed to `gij' should be interpreted
|
1933 |
|
|
as the name of a jar file, not a class.
|
1934 |
|
|
|
1935 |
|
|
`--help'
|
1936 |
|
|
`-?'
|
1937 |
|
|
Print help, then exit.
|
1938 |
|
|
|
1939 |
|
|
`--showversion'
|
1940 |
|
|
Print version number and continue.
|
1941 |
|
|
|
1942 |
|
|
`--fullversion'
|
1943 |
|
|
Print detailed version information, then exit.
|
1944 |
|
|
|
1945 |
|
|
`--version'
|
1946 |
|
|
Print version number, then exit.
|
1947 |
|
|
|
1948 |
|
|
`-verbose'
|
1949 |
|
|
`-verbose:class'
|
1950 |
|
|
Each time a class is initialized, print a short message on
|
1951 |
|
|
standard error.
|
1952 |
|
|
|
1953 |
|
|
`gij' also recognizes and ignores the following options, for
|
1954 |
|
|
compatibility with existing application launch scripts: `-client',
|
1955 |
|
|
`-server', `-hotspot', `-jrockit', `-agentlib', `-agentpath', `-debug',
|
1956 |
|
|
`-d32', `-d64', `-javaagent', `-noclassgc', `-verify', and
|
1957 |
|
|
`-verifyremote'.
|
1958 |
|
|
|
1959 |
|
|
|
1960 |
|
|
File: gcj.info, Node: Invoking gcj-dbtool, Next: Invoking jv-convert, Prev: Invoking gij, Up: Top
|
1961 |
|
|
|
1962 |
|
|
5 Invoking gcj-dbtool.
|
1963 |
|
|
**********************
|
1964 |
|
|
|
1965 |
|
|
`gcj-dbtool' is a tool for creating and manipulating class file mapping
|
1966 |
|
|
databases. `libgcj' can use these databases to find a shared library
|
1967 |
|
|
corresponding to the bytecode representation of a class. This
|
1968 |
|
|
functionality is useful for ahead-of-time compilation of a program that
|
1969 |
|
|
has no knowledge of `gcj'.
|
1970 |
|
|
|
1971 |
|
|
`gcj-dbtool' works best if all the jar files added to it are
|
1972 |
|
|
compiled using `-findirect-dispatch'.
|
1973 |
|
|
|
1974 |
|
|
Note that `gcj-dbtool' is currently available as "preview
|
1975 |
|
|
technology". We believe it is a reasonable way to allow
|
1976 |
|
|
application-transparent ahead-of-time compilation, but this is an
|
1977 |
|
|
unexplored area. We welcome your comments.
|
1978 |
|
|
|
1979 |
|
|
`-n DBFILE [SIZE]'
|
1980 |
|
|
This creates a new database. Currently, databases cannot be
|
1981 |
|
|
resized; you can choose a larger initial size if desired. The
|
1982 |
|
|
default size is 32,749.
|
1983 |
|
|
|
1984 |
|
|
`-a DBFILE JARFILE LIB'
|
1985 |
|
|
`-f DBFILE JARFILE LIB'
|
1986 |
|
|
This adds a jar file to the database. For each class file in the
|
1987 |
|
|
jar, a cryptographic signature of the bytecode representation of
|
1988 |
|
|
the class is recorded in the database. At runtime, a class is
|
1989 |
|
|
looked up by its signature and the compiled form of the class is
|
1990 |
|
|
looked for in the corresponding shared library. The `-a' option
|
1991 |
|
|
will verify that LIB exists before adding it to the database; `-f'
|
1992 |
|
|
skips this check.
|
1993 |
|
|
|
1994 |
|
|
`[`-'][`-0'] -m DBFILE DBFILE,[DBFILE]'
|
1995 |
|
|
Merge a number of databases. The output database overwrites any
|
1996 |
|
|
existing database. To add databases into an existing database,
|
1997 |
|
|
include the destination in the list of sources.
|
1998 |
|
|
|
1999 |
|
|
If `-' or `-0' are used, the list of files to read is taken from
|
2000 |
|
|
standard input instead of the command line. For `-0', Input
|
2001 |
|
|
filenames are terminated by a null character instead of by
|
2002 |
|
|
whitespace. Useful when arguments might contain white space. The
|
2003 |
|
|
GNU find -print0 option produces input suitable for this mode.
|
2004 |
|
|
|
2005 |
|
|
`-t DBFILE'
|
2006 |
|
|
Test a database.
|
2007 |
|
|
|
2008 |
|
|
`-l DBFILE'
|
2009 |
|
|
List the contents of a database.
|
2010 |
|
|
|
2011 |
|
|
`-p'
|
2012 |
|
|
Print the name of the default database. If there is no default
|
2013 |
|
|
database, this prints a blank line. If LIBDIR is specified, use
|
2014 |
|
|
it instead of the default library directory component of the
|
2015 |
|
|
database name.
|
2016 |
|
|
|
2017 |
|
|
`--help'
|
2018 |
|
|
Print a help message, then exit.
|
2019 |
|
|
|
2020 |
|
|
`--version'
|
2021 |
|
|
`-v'
|
2022 |
|
|
Print version information, then exit.
|
2023 |
|
|
|
2024 |
|
|
|
2025 |
|
|
|
2026 |
|
|
File: gcj.info, Node: Invoking jv-convert, Next: Invoking grmic, Prev: Invoking gcj-dbtool, Up: Top
|
2027 |
|
|
|
2028 |
|
|
6 Invoking jv-convert
|
2029 |
|
|
*********************
|
2030 |
|
|
|
2031 |
|
|
`jv-convert' [`OPTION'] ... [INPUTFILE [OUTPUTFILE]]
|
2032 |
|
|
|
2033 |
|
|
`jv-convert' is a utility included with `libgcj' which converts a
|
2034 |
|
|
file from one encoding to another. It is similar to the Unix `iconv'
|
2035 |
|
|
utility.
|
2036 |
|
|
|
2037 |
|
|
The encodings supported by `jv-convert' are platform-dependent.
|
2038 |
|
|
Currently there is no way to get a list of all supported encodings.
|
2039 |
|
|
|
2040 |
|
|
`--encoding NAME'
|
2041 |
|
|
`--from NAME'
|
2042 |
|
|
Use NAME as the input encoding. The default is the current
|
2043 |
|
|
locale's encoding.
|
2044 |
|
|
|
2045 |
|
|
`--to NAME'
|
2046 |
|
|
Use NAME as the output encoding. The default is the `JavaSrc'
|
2047 |
|
|
encoding; this is ASCII with `\u' escapes for non-ASCII characters.
|
2048 |
|
|
|
2049 |
|
|
`-i FILE'
|
2050 |
|
|
Read from FILE. The default is to read from standard input.
|
2051 |
|
|
|
2052 |
|
|
`-o FILE'
|
2053 |
|
|
Write to FILE. The default is to write to standard output.
|
2054 |
|
|
|
2055 |
|
|
`--reverse'
|
2056 |
|
|
Swap the input and output encodings.
|
2057 |
|
|
|
2058 |
|
|
`--help'
|
2059 |
|
|
Print a help message, then exit.
|
2060 |
|
|
|
2061 |
|
|
`--version'
|
2062 |
|
|
Print version information, then exit.
|
2063 |
|
|
|
2064 |
|
|
|
2065 |
|
|
File: gcj.info, Node: Invoking grmic, Next: Invoking gc-analyze, Prev: Invoking jv-convert, Up: Top
|
2066 |
|
|
|
2067 |
|
|
7 Invoking grmic
|
2068 |
|
|
****************
|
2069 |
|
|
|
2070 |
|
|
`grmic' [`OPTION'] ... CLASS ...
|
2071 |
|
|
|
2072 |
|
|
`grmic' is a utility included with `libgcj' which generates stubs
|
2073 |
|
|
for remote objects.
|
2074 |
|
|
|
2075 |
|
|
Note that this program isn't yet fully compatible with the JDK
|
2076 |
|
|
`grmic'. Some options, such as `-classpath', are recognized but
|
2077 |
|
|
currently ignored. We have left these options undocumented for now.
|
2078 |
|
|
|
2079 |
|
|
Long options can also be given with a GNU-style leading `--'. For
|
2080 |
|
|
instance, `--help' is accepted.
|
2081 |
|
|
|
2082 |
|
|
`-keep'
|
2083 |
|
|
`-keepgenerated'
|
2084 |
|
|
By default, `grmic' deletes intermediate files. Either of these
|
2085 |
|
|
options causes it not to delete such files.
|
2086 |
|
|
|
2087 |
|
|
`-v1.1'
|
2088 |
|
|
Cause `grmic' to create stubs and skeletons for the 1.1 protocol
|
2089 |
|
|
version.
|
2090 |
|
|
|
2091 |
|
|
`-vcompat'
|
2092 |
|
|
Cause `grmic' to create stubs and skeletons compatible with both
|
2093 |
|
|
the 1.1 and 1.2 protocol versions. This is the default.
|
2094 |
|
|
|
2095 |
|
|
`-v1.2'
|
2096 |
|
|
Cause `grmic' to create stubs and skeletons for the 1.2 protocol
|
2097 |
|
|
version.
|
2098 |
|
|
|
2099 |
|
|
`-nocompile'
|
2100 |
|
|
Don't compile the generated files.
|
2101 |
|
|
|
2102 |
|
|
`-verbose'
|
2103 |
|
|
Print information about what `grmic' is doing.
|
2104 |
|
|
|
2105 |
|
|
`-d DIRECTORY'
|
2106 |
|
|
Put output files in DIRECTORY. By default the files are put in
|
2107 |
|
|
the current working directory.
|
2108 |
|
|
|
2109 |
|
|
`-help'
|
2110 |
|
|
Print a help message, then exit.
|
2111 |
|
|
|
2112 |
|
|
`-version'
|
2113 |
|
|
Print version information, then exit.
|
2114 |
|
|
|
2115 |
|
|
|
2116 |
|
|
File: gcj.info, Node: Invoking gc-analyze, Next: Invoking aot-compile, Prev: Invoking grmic, Up: Top
|
2117 |
|
|
|
2118 |
|
|
8 Invoking gc-analyze
|
2119 |
|
|
*********************
|
2120 |
|
|
|
2121 |
|
|
`gc-analyze' [`OPTION'] ... [FILE]
|
2122 |
|
|
|
2123 |
|
|
`gc-analyze' prints an analysis of a GC memory dump to standard out.
|
2124 |
|
|
|
2125 |
|
|
The memory dumps may be created by calling
|
2126 |
|
|
`gnu.gcj.util.GCInfo.enumerate(String namePrefix)' from java code. A
|
2127 |
|
|
memory dump will be created on an out of memory condition if
|
2128 |
|
|
`gnu.gcj.util.GCInfo.setOOMDump(String namePrefix)' is called before
|
2129 |
|
|
the out of memory occurs.
|
2130 |
|
|
|
2131 |
|
|
Running this program will create two files: `TestDump001' and
|
2132 |
|
|
`TestDump001.bytes'.
|
2133 |
|
|
|
2134 |
|
|
import gnu.gcj.util.*;
|
2135 |
|
|
import java.util.*;
|
2136 |
|
|
|
2137 |
|
|
public class GCDumpTest
|
2138 |
|
|
{
|
2139 |
|
|
static public void main(String args[])
|
2140 |
|
|
{
|
2141 |
|
|
ArrayList l = new ArrayList(1000);
|
2142 |
|
|
|
2143 |
|
|
for (int i = 1; i < 1500; i++) {
|
2144 |
|
|
l.add("This is string #" + i);
|
2145 |
|
|
}
|
2146 |
|
|
GCInfo.enumerate("TestDump");
|
2147 |
|
|
}
|
2148 |
|
|
}
|
2149 |
|
|
|
2150 |
|
|
The memory dump may then be displayed by running:
|
2151 |
|
|
|
2152 |
|
|
gc-analyze -v TestDump001
|
2153 |
|
|
|
2154 |
|
|
`--verbose'
|
2155 |
|
|
`-v'
|
2156 |
|
|
Verbose output.
|
2157 |
|
|
|
2158 |
|
|
`-p TOOL-PREFIX'
|
2159 |
|
|
Prefix added to the names of the `nm' and `readelf' commands.
|
2160 |
|
|
|
2161 |
|
|
`-d DIRECTORY'
|
2162 |
|
|
Directory that contains the executable and shared libraries used
|
2163 |
|
|
when the dump was generated.
|
2164 |
|
|
|
2165 |
|
|
`--help'
|
2166 |
|
|
Print a help message, then exit.
|
2167 |
|
|
|
2168 |
|
|
`--version'
|
2169 |
|
|
Print version information, then exit.
|
2170 |
|
|
|
2171 |
|
|
|
2172 |
|
|
File: gcj.info, Node: Invoking aot-compile, Next: Invoking rebuild-gcj-db, Prev: Invoking gc-analyze, Up: Top
|
2173 |
|
|
|
2174 |
|
|
9 Invoking aot-compile
|
2175 |
|
|
**********************
|
2176 |
|
|
|
2177 |
|
|
`aot-compile' is a script that searches a directory for Java bytecode
|
2178 |
|
|
(as class files, or in jars) and uses `gcj' to compile it to native
|
2179 |
|
|
code and generate the databases from it.
|
2180 |
|
|
|
2181 |
|
|
`-M, --make=PATH'
|
2182 |
|
|
Specify the path to the `make' executable to use.
|
2183 |
|
|
|
2184 |
|
|
`-C, --gcj=PATH'
|
2185 |
|
|
Specify the path to the `gcj' executable to use.
|
2186 |
|
|
|
2187 |
|
|
`-D, --dbtool=PATH'
|
2188 |
|
|
Specify the path to the `gcj-dbtool' executable to use.
|
2189 |
|
|
|
2190 |
|
|
`-m, --makeflags=FLAGS'
|
2191 |
|
|
Specify flags to pass to `make' during the build.
|
2192 |
|
|
|
2193 |
|
|
`-c, --gcjflags=FLAGS'
|
2194 |
|
|
Specify flags to pass to `gcj' during compilation, in addition to
|
2195 |
|
|
'-fPIC -findirect-dispatch -fjni'.
|
2196 |
|
|
|
2197 |
|
|
`-l, --ldflags=FLAGS'
|
2198 |
|
|
Specify flags to pass to `gcj' during linking, in addition to
|
2199 |
|
|
'-Wl,-Bsymbolic'.
|
2200 |
|
|
|
2201 |
|
|
`-e, --exclude=PATH'
|
2202 |
|
|
Do not compile PATH.
|
2203 |
|
|
|
2204 |
|
|
|
2205 |
|
|
|
2206 |
|
|
File: gcj.info, Node: Invoking rebuild-gcj-db, Next: About CNI, Prev: Invoking aot-compile, Up: Top
|
2207 |
|
|
|
2208 |
|
|
10 Invoking rebuild-gcj-db
|
2209 |
|
|
**************************
|
2210 |
|
|
|
2211 |
|
|
`rebuild-gcj-db' is a script that merges the per-solib databases made by
|
2212 |
|
|
`aot-compile' into one system-wide database so `gij' can find the
|
2213 |
|
|
solibs.
|
2214 |
|
|
|
2215 |
|
|
|
2216 |
|
|
File: gcj.info, Node: About CNI, Next: System properties, Prev: Invoking rebuild-gcj-db, Up: Top
|
2217 |
|
|
|
2218 |
|
|
11 About CNI
|
2219 |
|
|
************
|
2220 |
|
|
|
2221 |
|
|
This documents CNI, the Compiled Native Interface, which is is a
|
2222 |
|
|
convenient way to write Java native methods using C++. This is a more
|
2223 |
|
|
efficient, more convenient, but less portable alternative to the
|
2224 |
|
|
standard JNI (Java Native Interface).
|
2225 |
|
|
|
2226 |
|
|
* Menu:
|
2227 |
|
|
|
2228 |
|
|
* Basic concepts:: Introduction to using CNI.
|
2229 |
|
|
* Packages:: How packages are mapped to C++.
|
2230 |
|
|
* Primitive types:: Handling primitive Java types in C++.
|
2231 |
|
|
* Reference types:: Handling Java reference types in C++.
|
2232 |
|
|
* Interfaces:: How Java interfaces map to C++.
|
2233 |
|
|
* Objects and Classes:: C++ and Java classes.
|
2234 |
|
|
* Class Initialization:: How objects are initialized.
|
2235 |
|
|
* Object allocation:: How to create Java objects in C++.
|
2236 |
|
|
* Memory allocation:: How to allocate and free memory.
|
2237 |
|
|
* Arrays:: Dealing with Java arrays in C++.
|
2238 |
|
|
* Methods:: Java methods in C++.
|
2239 |
|
|
* Strings:: Information about Java Strings.
|
2240 |
|
|
* Mixing with C++:: How CNI can interoperate with C++.
|
2241 |
|
|
* Exception Handling:: How exceptions are handled.
|
2242 |
|
|
* Synchronization:: Synchronizing between Java and C++.
|
2243 |
|
|
* Invocation:: Starting the Java runtime from C++.
|
2244 |
|
|
* Reflection:: Using reflection from C++.
|
2245 |
|
|
|
2246 |
|
|
|
2247 |
|
|
File: gcj.info, Node: Basic concepts, Next: Packages, Up: About CNI
|
2248 |
|
|
|
2249 |
|
|
11.1 Basic concepts
|
2250 |
|
|
===================
|
2251 |
|
|
|
2252 |
|
|
In terms of languages features, Java is mostly a subset of C++. Java
|
2253 |
|
|
has a few important extensions, plus a powerful standard class library,
|
2254 |
|
|
but on the whole that does not change the basic similarity. Java is a
|
2255 |
|
|
hybrid object-oriented language, with a few native types, in addition
|
2256 |
|
|
to class types. It is class-based, where a class may have static as
|
2257 |
|
|
well as per-object fields, and static as well as instance methods.
|
2258 |
|
|
Non-static methods may be virtual, and may be overloaded. Overloading
|
2259 |
|
|
is resolved at compile time by matching the actual argument types
|
2260 |
|
|
against the parameter types. Virtual methods are implemented using
|
2261 |
|
|
indirect calls through a dispatch table (virtual function table).
|
2262 |
|
|
Objects are allocated on the heap, and initialized using a constructor
|
2263 |
|
|
method. Classes are organized in a package hierarchy.
|
2264 |
|
|
|
2265 |
|
|
All of the listed attributes are also true of C++, though C++ has
|
2266 |
|
|
extra features (for example in C++ objects may be allocated not just on
|
2267 |
|
|
the heap, but also statically or in a local stack frame). Because
|
2268 |
|
|
`gcj' uses the same compiler technology as G++ (the GNU C++ compiler),
|
2269 |
|
|
it is possible to make the intersection of the two languages use the
|
2270 |
|
|
same ABI (object representation and calling conventions). The key idea
|
2271 |
|
|
in CNI is that Java objects are C++ objects, and all Java classes are
|
2272 |
|
|
C++ classes (but not the other way around). So the most important task
|
2273 |
|
|
in integrating Java and C++ is to remove gratuitous incompatibilities.
|
2274 |
|
|
|
2275 |
|
|
You write CNI code as a regular C++ source file. (You do have to use
|
2276 |
|
|
a Java/CNI-aware C++ compiler, specifically a recent version of G++.)
|
2277 |
|
|
|
2278 |
|
|
A CNI C++ source file must have:
|
2279 |
|
|
|
2280 |
|
|
#include
|
2281 |
|
|
|
2282 |
|
|
and then must include one header file for each Java class it uses, e.g.:
|
2283 |
|
|
|
2284 |
|
|
#include
|
2285 |
|
|
#include
|
2286 |
|
|
#include
|
2287 |
|
|
|
2288 |
|
|
These header files are automatically generated by `gcjh'.
|
2289 |
|
|
|
2290 |
|
|
CNI provides some functions and macros to make using Java objects and
|
2291 |
|
|
primitive types from C++ easier. In general, these CNI functions and
|
2292 |
|
|
macros start with the `Jv' prefix, for example the function
|
2293 |
|
|
`JvNewObjectArray'. This convention is used to avoid conflicts with
|
2294 |
|
|
other libraries. Internal functions in CNI start with the prefix
|
2295 |
|
|
`_Jv_'. You should not call these; if you find a need to, let us know
|
2296 |
|
|
and we will try to come up with an alternate solution.
|
2297 |
|
|
|
2298 |
|
|
11.1.1 Limitations
|
2299 |
|
|
------------------
|
2300 |
|
|
|
2301 |
|
|
Whilst a Java class is just a C++ class that doesn't mean that you are
|
2302 |
|
|
freed from the shackles of Java, a CNI C++ class must adhere to the
|
2303 |
|
|
rules of the Java programming language.
|
2304 |
|
|
|
2305 |
|
|
For example: it is not possible to declare a method in a CNI class
|
2306 |
|
|
that will take a C string (`char*') as an argument, or to declare a
|
2307 |
|
|
member variable of some non-Java datatype.
|
2308 |
|
|
|
2309 |
|
|
|
2310 |
|
|
File: gcj.info, Node: Packages, Next: Primitive types, Prev: Basic concepts, Up: About CNI
|
2311 |
|
|
|
2312 |
|
|
11.2 Packages
|
2313 |
|
|
=============
|
2314 |
|
|
|
2315 |
|
|
The only global names in Java are class names, and packages. A
|
2316 |
|
|
"package" can contain zero or more classes, and also zero or more
|
2317 |
|
|
sub-packages. Every class belongs to either an unnamed package or a
|
2318 |
|
|
package that has a hierarchical and globally unique name.
|
2319 |
|
|
|
2320 |
|
|
A Java package is mapped to a C++ "namespace". The Java class
|
2321 |
|
|
`java.lang.String' is in the package `java.lang', which is a
|
2322 |
|
|
sub-package of `java'. The C++ equivalent is the class
|
2323 |
|
|
`java::lang::String', which is in the namespace `java::lang' which is
|
2324 |
|
|
in the namespace `java'.
|
2325 |
|
|
|
2326 |
|
|
Here is how you could express this:
|
2327 |
|
|
|
2328 |
|
|
(// Declare the class(es), possibly in a header file:
|
2329 |
|
|
namespace java {
|
2330 |
|
|
namespace lang {
|
2331 |
|
|
class Object;
|
2332 |
|
|
class String;
|
2333 |
|
|
...
|
2334 |
|
|
}
|
2335 |
|
|
}
|
2336 |
|
|
|
2337 |
|
|
class java::lang::String : public java::lang::Object
|
2338 |
|
|
{
|
2339 |
|
|
...
|
2340 |
|
|
};
|
2341 |
|
|
|
2342 |
|
|
The `gcjh' tool automatically generates the necessary namespace
|
2343 |
|
|
declarations.
|
2344 |
|
|
|
2345 |
|
|
11.2.1 Leaving out package names
|
2346 |
|
|
--------------------------------
|
2347 |
|
|
|
2348 |
|
|
Always using the fully-qualified name of a java class can be tiresomely
|
2349 |
|
|
verbose. Using the full qualified name also ties the code to a single
|
2350 |
|
|
package making code changes necessary should the class move from one
|
2351 |
|
|
package to another. The Java `package' declaration specifies that the
|
2352 |
|
|
following class declarations are in the named package, without having
|
2353 |
|
|
to explicitly name the full package qualifiers. The `package'
|
2354 |
|
|
declaration can be followed by zero or more `import' declarations, which
|
2355 |
|
|
allows either a single class or all the classes in a package to be
|
2356 |
|
|
named by a simple identifier. C++ provides something similar with the
|
2357 |
|
|
`using' declaration and directive.
|
2358 |
|
|
|
2359 |
|
|
In Java:
|
2360 |
|
|
|
2361 |
|
|
import PACKAGE-NAME.CLASS-NAME;
|
2362 |
|
|
|
2363 |
|
|
allows the program text to refer to CLASS-NAME as a shorthand for the
|
2364 |
|
|
fully qualified name: `PACKAGE-NAME.CLASS-NAME'.
|
2365 |
|
|
|
2366 |
|
|
To achieve the same effect C++, you have to do this:
|
2367 |
|
|
|
2368 |
|
|
using PACKAGE-NAME::CLASS-NAME;
|
2369 |
|
|
|
2370 |
|
|
Java can also cause imports on demand, like this:
|
2371 |
|
|
|
2372 |
|
|
import PACKAGE-NAME.*;
|
2373 |
|
|
|
2374 |
|
|
Doing this allows any class from the package PACKAGE-NAME to be
|
2375 |
|
|
referred to only by its class-name within the program text.
|
2376 |
|
|
|
2377 |
|
|
The same effect can be achieved in C++ like this:
|
2378 |
|
|
|
2379 |
|
|
using namespace PACKAGE-NAME;
|
2380 |
|
|
|
2381 |
|
|
|
2382 |
|
|
File: gcj.info, Node: Primitive types, Next: Reference types, Prev: Packages, Up: About CNI
|
2383 |
|
|
|
2384 |
|
|
11.3 Primitive types
|
2385 |
|
|
====================
|
2386 |
|
|
|
2387 |
|
|
Java provides 8 "primitives" types which represent integers, floats,
|
2388 |
|
|
characters and booleans (and also the void type). C++ has its own very
|
2389 |
|
|
similar concrete types. Such types in C++ however are not always
|
2390 |
|
|
implemented in the same way (an int might be 16, 32 or 64 bits for
|
2391 |
|
|
example) so CNI provides a special C++ type for each primitive Java
|
2392 |
|
|
type:
|
2393 |
|
|
|
2394 |
|
|
*Java type* *C/C++ typename* *Description*
|
2395 |
|
|
`char' `jchar' 16 bit Unicode character
|
2396 |
|
|
`boolean' `jboolean' logical (true or false) values
|
2397 |
|
|
`byte' `jbyte' 8-bit signed integer
|
2398 |
|
|
`short' `jshort' 16 bit signed integer
|
2399 |
|
|
`int' `jint' 32 bit signed integer
|
2400 |
|
|
`long' `jlong' 64 bit signed integer
|
2401 |
|
|
`float' `jfloat' 32 bit IEEE floating point number
|
2402 |
|
|
`double' `jdouble' 64 bit IEEE floating point number
|
2403 |
|
|
`void' `void' no value
|
2404 |
|
|
|
2405 |
|
|
When referring to a Java type You should always use these C++
|
2406 |
|
|
typenames (e.g.: `jint') to avoid disappointment.
|
2407 |
|
|
|
2408 |
|
|
11.3.1 Reference types associated with primitive types
|
2409 |
|
|
------------------------------------------------------
|
2410 |
|
|
|
2411 |
|
|
In Java each primitive type has an associated reference type, e.g.:
|
2412 |
|
|
`boolean' has an associated `java.lang.Boolean.TYPE' class. In order
|
2413 |
|
|
to make working with such classes easier GCJ provides the macro
|
2414 |
|
|
`JvPrimClass':
|
2415 |
|
|
|
2416 |
|
|
-- macro: JvPrimClass type
|
2417 |
|
|
Return a pointer to the `Class' object corresponding to the type
|
2418 |
|
|
supplied.
|
2419 |
|
|
|
2420 |
|
|
JvPrimClass(void) => java.lang.Void.TYPE
|
2421 |
|
|
|
2422 |
|
|
|
2423 |
|
|
|
2424 |
|
|
File: gcj.info, Node: Reference types, Next: Interfaces, Prev: Primitive types, Up: About CNI
|
2425 |
|
|
|
2426 |
|
|
11.4 Reference types
|
2427 |
|
|
====================
|
2428 |
|
|
|
2429 |
|
|
A Java reference type is treated as a class in C++. Classes and
|
2430 |
|
|
interfaces are handled this way. A Java reference is translated to a
|
2431 |
|
|
C++ pointer, so for instance a Java `java.lang.String' becomes, in C++,
|
2432 |
|
|
`java::lang::String *'.
|
2433 |
|
|
|
2434 |
|
|
CNI provides a few built-in typedefs for the most common classes:
|
2435 |
|
|
*Java type* *C++ typename* *Description*
|
2436 |
|
|
`java.lang.Object' `jobject' Object type
|
2437 |
|
|
`java.lang.String' `jstring' String type
|
2438 |
|
|
`java.lang.Class' `jclass' Class type
|
2439 |
|
|
|
2440 |
|
|
Every Java class or interface has a corresponding `Class' instance.
|
2441 |
|
|
These can be accessed in CNI via the static `class$' field of a class.
|
2442 |
|
|
The `class$' field is of type `Class' (and not `Class *'), so you will
|
2443 |
|
|
typically take the address of it.
|
2444 |
|
|
|
2445 |
|
|
Here is how you can refer to the class of `String', which in Java
|
2446 |
|
|
would be written `String.class':
|
2447 |
|
|
|
2448 |
|
|
using namespace java::lang;
|
2449 |
|
|
doSomething (&String::class$);
|
2450 |
|
|
|
2451 |
|
|
|
2452 |
|
|
File: gcj.info, Node: Interfaces, Next: Objects and Classes, Prev: Reference types, Up: About CNI
|
2453 |
|
|
|
2454 |
|
|
11.5 Interfaces
|
2455 |
|
|
===============
|
2456 |
|
|
|
2457 |
|
|
A Java class can "implement" zero or more "interfaces", in addition to
|
2458 |
|
|
inheriting from a single base class.
|
2459 |
|
|
|
2460 |
|
|
CNI allows CNI code to implement methods of interfaces. You can
|
2461 |
|
|
also call methods through interface references, with some limitations.
|
2462 |
|
|
|
2463 |
|
|
CNI doesn't understand interface inheritance at all yet. So, you
|
2464 |
|
|
can only call an interface method when the declared type of the field
|
2465 |
|
|
being called matches the interface which declares that method. The
|
2466 |
|
|
workaround is to cast the interface reference to the right
|
2467 |
|
|
superinterface.
|
2468 |
|
|
|
2469 |
|
|
For example if you have:
|
2470 |
|
|
|
2471 |
|
|
interface A
|
2472 |
|
|
{
|
2473 |
|
|
void a();
|
2474 |
|
|
}
|
2475 |
|
|
|
2476 |
|
|
interface B extends A
|
2477 |
|
|
{
|
2478 |
|
|
void b();
|
2479 |
|
|
}
|
2480 |
|
|
|
2481 |
|
|
and declare a variable of type `B' in C++, you can't call `a()'
|
2482 |
|
|
unless you cast it to an `A' first.
|
2483 |
|
|
|
2484 |
|
|
|
2485 |
|
|
File: gcj.info, Node: Objects and Classes, Next: Class Initialization, Prev: Interfaces, Up: About CNI
|
2486 |
|
|
|
2487 |
|
|
11.6 Objects and Classes
|
2488 |
|
|
========================
|
2489 |
|
|
|
2490 |
|
|
11.6.1 Classes
|
2491 |
|
|
--------------
|
2492 |
|
|
|
2493 |
|
|
All Java classes are derived from `java.lang.Object'. C++ does not
|
2494 |
|
|
have a unique root class, but we use the C++ class `java::lang::Object'
|
2495 |
|
|
as the C++ version of the `java.lang.Object' Java class. All other
|
2496 |
|
|
Java classes are mapped into corresponding C++ classes derived from
|
2497 |
|
|
`java::lang::Object'.
|
2498 |
|
|
|
2499 |
|
|
Interface inheritance (the `implements' keyword) is currently not
|
2500 |
|
|
reflected in the C++ mapping.
|
2501 |
|
|
|
2502 |
|
|
11.6.2 Object fields
|
2503 |
|
|
--------------------
|
2504 |
|
|
|
2505 |
|
|
Each object contains an object header, followed by the instance fields
|
2506 |
|
|
of the class, in order. The object header consists of a single pointer
|
2507 |
|
|
to a dispatch or virtual function table. (There may be extra fields
|
2508 |
|
|
_in front of_ the object, for example for memory management, but this
|
2509 |
|
|
is invisible to the application, and the reference to the object points
|
2510 |
|
|
to the dispatch table pointer.)
|
2511 |
|
|
|
2512 |
|
|
The fields are laid out in the same order, alignment, and size as in
|
2513 |
|
|
C++. Specifically, 8-bit and 16-bit native types (`byte', `short',
|
2514 |
|
|
`char', and `boolean') are _not_ widened to 32 bits. Note that the
|
2515 |
|
|
Java VM does extend 8-bit and 16-bit types to 32 bits when on the VM
|
2516 |
|
|
stack or temporary registers.
|
2517 |
|
|
|
2518 |
|
|
If you include the `gcjh'-generated header for a class, you can
|
2519 |
|
|
access fields of Java classes in the _natural_ way. For example, given
|
2520 |
|
|
the following Java class:
|
2521 |
|
|
|
2522 |
|
|
public class Int
|
2523 |
|
|
{
|
2524 |
|
|
public int i;
|
2525 |
|
|
public Int (int i) { this.i = i; }
|
2526 |
|
|
public static Int zero = new Int(0);
|
2527 |
|
|
}
|
2528 |
|
|
|
2529 |
|
|
you can write:
|
2530 |
|
|
|
2531 |
|
|
#include ;
|
2532 |
|
|
#include ;
|
2533 |
|
|
|
2534 |
|
|
Int*
|
2535 |
|
|
mult (Int *p, jint k)
|
2536 |
|
|
{
|
2537 |
|
|
if (k == 0)
|
2538 |
|
|
return Int::zero; // Static member access.
|
2539 |
|
|
return new Int(p->i * k);
|
2540 |
|
|
}
|
2541 |
|
|
|
2542 |
|
|
11.6.3 Access specifiers
|
2543 |
|
|
------------------------
|
2544 |
|
|
|
2545 |
|
|
CNI does not strictly enforce the Java access specifiers, because Java
|
2546 |
|
|
permissions cannot be directly mapped into C++ permission. Private
|
2547 |
|
|
Java fields and methods are mapped to private C++ fields and methods,
|
2548 |
|
|
but other fields and methods are mapped to public fields and methods.
|
2549 |
|
|
|
2550 |
|
|
|
2551 |
|
|
File: gcj.info, Node: Class Initialization, Next: Object allocation, Prev: Objects and Classes, Up: About CNI
|
2552 |
|
|
|
2553 |
|
|
11.7 Class Initialization
|
2554 |
|
|
=========================
|
2555 |
|
|
|
2556 |
|
|
Java requires that each class be automatically initialized at the time
|
2557 |
|
|
of the first active use. Initializing a class involves initializing
|
2558 |
|
|
the static fields, running code in class initializer methods, and
|
2559 |
|
|
initializing base classes. There may also be some implementation
|
2560 |
|
|
specific actions, such as allocating `String' objects corresponding to
|
2561 |
|
|
string literals in the code.
|
2562 |
|
|
|
2563 |
|
|
The GCJ compiler inserts calls to `JvInitClass' at appropriate
|
2564 |
|
|
places to ensure that a class is initialized when required. The C++
|
2565 |
|
|
compiler does not insert these calls automatically--it is the
|
2566 |
|
|
programmer's responsibility to make sure classes are initialized.
|
2567 |
|
|
However, this is fairly painless because of the conventions assumed by
|
2568 |
|
|
the Java system.
|
2569 |
|
|
|
2570 |
|
|
First, `libgcj' will make sure a class is initialized before an
|
2571 |
|
|
instance of that object is created. This is one of the
|
2572 |
|
|
responsibilities of the `new' operation. This is taken care of both in
|
2573 |
|
|
Java code, and in C++ code. When G++ sees a `new' of a Java class, it
|
2574 |
|
|
will call a routine in `libgcj' to allocate the object, and that
|
2575 |
|
|
routine will take care of initializing the class. Note however that
|
2576 |
|
|
this does not happen for Java arrays; you must allocate those using the
|
2577 |
|
|
appropriate CNI function. It follows that you can access an instance
|
2578 |
|
|
field, or call an instance (non-static) method and be safe in the
|
2579 |
|
|
knowledge that the class and all of its base classes have been
|
2580 |
|
|
initialized.
|
2581 |
|
|
|
2582 |
|
|
Invoking a static method is also safe. This is because the Java
|
2583 |
|
|
compiler adds code to the start of a static method to make sure the
|
2584 |
|
|
class is initialized. However, the C++ compiler does not add this
|
2585 |
|
|
extra code. Hence, if you write a native static method using CNI, you
|
2586 |
|
|
are responsible for calling `JvInitClass' before doing anything else in
|
2587 |
|
|
the method (unless you are sure it is safe to leave it out).
|
2588 |
|
|
|
2589 |
|
|
Accessing a static field also requires the class of the field to be
|
2590 |
|
|
initialized. The Java compiler will generate code to call
|
2591 |
|
|
`JvInitClass' before getting or setting the field. However, the C++
|
2592 |
|
|
compiler will not generate this extra code, so it is your
|
2593 |
|
|
responsibility to make sure the class is initialized before you access
|
2594 |
|
|
a static field from C++.
|
2595 |
|
|
|
2596 |
|
|
|
2597 |
|
|
File: gcj.info, Node: Object allocation, Next: Memory allocation, Prev: Class Initialization, Up: About CNI
|
2598 |
|
|
|
2599 |
|
|
11.8 Object allocation
|
2600 |
|
|
======================
|
2601 |
|
|
|
2602 |
|
|
New Java objects are allocated using a "class instance creation
|
2603 |
|
|
expression", e.g.:
|
2604 |
|
|
|
2605 |
|
|
new TYPE ( ... )
|
2606 |
|
|
|
2607 |
|
|
The same syntax is used in C++. The main difference is that C++
|
2608 |
|
|
objects have to be explicitly deleted; in Java they are automatically
|
2609 |
|
|
deleted by the garbage collector. Using CNI, you can allocate a new
|
2610 |
|
|
Java object using standard C++ syntax and the C++ compiler will allocate
|
2611 |
|
|
memory from the garbage collector. If you have overloaded
|
2612 |
|
|
constructors, the compiler will choose the correct one using standard
|
2613 |
|
|
C++ overload resolution rules.
|
2614 |
|
|
|
2615 |
|
|
For example:
|
2616 |
|
|
|
2617 |
|
|
java::util::Hashtable *ht = new java::util::Hashtable(120);
|
2618 |
|
|
|
2619 |
|
|
|
2620 |
|
|
File: gcj.info, Node: Memory allocation, Next: Arrays, Prev: Object allocation, Up: About CNI
|
2621 |
|
|
|
2622 |
|
|
11.9 Memory allocation
|
2623 |
|
|
======================
|
2624 |
|
|
|
2625 |
|
|
When allocating memory in CNI methods it is best to handle
|
2626 |
|
|
out-of-memory conditions by throwing a Java exception. These functions
|
2627 |
|
|
are provided for that purpose:
|
2628 |
|
|
|
2629 |
|
|
-- Function: void* JvMalloc (jsize SIZE)
|
2630 |
|
|
Calls malloc. Throws `java.lang.OutOfMemoryError' if allocation
|
2631 |
|
|
fails.
|
2632 |
|
|
|
2633 |
|
|
-- Function: void* JvRealloc (void* PTR, jsize SIZE)
|
2634 |
|
|
Calls realloc. Throws `java.lang.OutOfMemoryError' if
|
2635 |
|
|
reallocation fails.
|
2636 |
|
|
|
2637 |
|
|
-- Function: void JvFree (void* PTR)
|
2638 |
|
|
Calls free.
|
2639 |
|
|
|
2640 |
|
|
|
2641 |
|
|
File: gcj.info, Node: Arrays, Next: Methods, Prev: Memory allocation, Up: About CNI
|
2642 |
|
|
|
2643 |
|
|
11.10 Arrays
|
2644 |
|
|
============
|
2645 |
|
|
|
2646 |
|
|
While in many ways Java is similar to C and C++, it is quite different
|
2647 |
|
|
in its treatment of arrays. C arrays are based on the idea of pointer
|
2648 |
|
|
arithmetic, which would be incompatible with Java's security
|
2649 |
|
|
requirements. Java arrays are true objects (array types inherit from
|
2650 |
|
|
`java.lang.Object'). An array-valued variable is one that contains a
|
2651 |
|
|
reference (pointer) to an array object.
|
2652 |
|
|
|
2653 |
|
|
Referencing a Java array in C++ code is done using the `JArray'
|
2654 |
|
|
template, which as defined as follows:
|
2655 |
|
|
|
2656 |
|
|
class __JArray : public java::lang::Object
|
2657 |
|
|
{
|
2658 |
|
|
public:
|
2659 |
|
|
int length;
|
2660 |
|
|
};
|
2661 |
|
|
|
2662 |
|
|
template
|
2663 |
|
|
class JArray : public __JArray
|
2664 |
|
|
{
|
2665 |
|
|
T data[0];
|
2666 |
|
|
public:
|
2667 |
|
|
T& operator[](jint i) { return data[i]; }
|
2668 |
|
|
};
|
2669 |
|
|
|
2670 |
|
|
There are a number of `typedef's which correspond to `typedef's from
|
2671 |
|
|
the JNI. Each is the type of an array holding objects of the relevant
|
2672 |
|
|
type:
|
2673 |
|
|
|
2674 |
|
|
typedef __JArray *jarray;
|
2675 |
|
|
typedef JArray *jobjectArray;
|
2676 |
|
|
typedef JArray *jbooleanArray;
|
2677 |
|
|
typedef JArray *jbyteArray;
|
2678 |
|
|
typedef JArray *jcharArray;
|
2679 |
|
|
typedef JArray *jshortArray;
|
2680 |
|
|
typedef JArray *jintArray;
|
2681 |
|
|
typedef JArray *jlongArray;
|
2682 |
|
|
typedef JArray *jfloatArray;
|
2683 |
|
|
typedef JArray *jdoubleArray;
|
2684 |
|
|
|
2685 |
|
|
-- Method on template: T* elements (JArray ARRAY)
|
2686 |
|
|
This template function can be used to get a pointer to the
|
2687 |
|
|
elements of the `array'. For instance, you can fetch a pointer to
|
2688 |
|
|
the integers that make up an `int[]' like so:
|
2689 |
|
|
|
2690 |
|
|
extern jintArray foo;
|
2691 |
|
|
jint *intp = elements (foo);
|
2692 |
|
|
|
2693 |
|
|
The name of this function may change in the future.
|
2694 |
|
|
|
2695 |
|
|
-- Function: jobjectArray JvNewObjectArray (jsize LENGTH, jclass
|
2696 |
|
|
KLASS, jobject INIT)
|
2697 |
|
|
This creates a new array whose elements have reference type.
|
2698 |
|
|
`klass' is the type of elements of the array and `init' is the
|
2699 |
|
|
initial value put into every slot in the array.
|
2700 |
|
|
|
2701 |
|
|
using namespace java::lang;
|
2702 |
|
|
JArray *array
|
2703 |
|
|
= (JArray *) JvNewObjectArray(length, &String::class$, NULL);
|
2704 |
|
|
|
2705 |
|
|
11.10.1 Creating arrays
|
2706 |
|
|
-----------------------
|
2707 |
|
|
|
2708 |
|
|
For each primitive type there is a function which can be used to create
|
2709 |
|
|
a new array of that type. The name of the function is of the form:
|
2710 |
|
|
|
2711 |
|
|
JvNewTYPEArray
|
2712 |
|
|
|
2713 |
|
|
For example:
|
2714 |
|
|
|
2715 |
|
|
JvNewBooleanArray
|
2716 |
|
|
|
2717 |
|
|
can be used to create an array of Java primitive boolean types.
|
2718 |
|
|
|
2719 |
|
|
The following function definition is the template for all such
|
2720 |
|
|
functions:
|
2721 |
|
|
|
2722 |
|
|
-- Function: jbooleanArray JvNewBooleanArray (jint LENGTH)
|
2723 |
|
|
Creates an array LENGTH indices long.
|
2724 |
|
|
|
2725 |
|
|
-- Function: jsize JvGetArrayLength (jarray ARRAY)
|
2726 |
|
|
Returns the length of the ARRAY.
|
2727 |
|
|
|
2728 |
|
|
|
2729 |
|
|
File: gcj.info, Node: Methods, Next: Strings, Prev: Arrays, Up: About CNI
|
2730 |
|
|
|
2731 |
|
|
11.11 Methods
|
2732 |
|
|
=============
|
2733 |
|
|
|
2734 |
|
|
Java methods are mapped directly into C++ methods. The header files
|
2735 |
|
|
generated by `gcjh' include the appropriate method definitions.
|
2736 |
|
|
Basically, the generated methods have the same names and
|
2737 |
|
|
_corresponding_ types as the Java methods, and are called in the
|
2738 |
|
|
natural manner.
|
2739 |
|
|
|
2740 |
|
|
11.11.1 Overloading
|
2741 |
|
|
-------------------
|
2742 |
|
|
|
2743 |
|
|
Both Java and C++ provide method overloading, where multiple methods in
|
2744 |
|
|
a class have the same name, and the correct one is chosen (at compile
|
2745 |
|
|
time) depending on the argument types. The rules for choosing the
|
2746 |
|
|
correct method are (as expected) more complicated in C++ than in Java,
|
2747 |
|
|
but given a set of overloaded methods generated by `gcjh' the C++
|
2748 |
|
|
compiler will choose the expected one.
|
2749 |
|
|
|
2750 |
|
|
Common assemblers and linkers are not aware of C++ overloading, so
|
2751 |
|
|
the standard implementation strategy is to encode the parameter types
|
2752 |
|
|
of a method into its assembly-level name. This encoding is called
|
2753 |
|
|
"mangling", and the encoded name is the "mangled name". The same
|
2754 |
|
|
mechanism is used to implement Java overloading. For C++/Java
|
2755 |
|
|
interoperability, it is important that both the Java and C++ compilers
|
2756 |
|
|
use the _same_ encoding scheme.
|
2757 |
|
|
|
2758 |
|
|
11.11.2 Static methods
|
2759 |
|
|
----------------------
|
2760 |
|
|
|
2761 |
|
|
Static Java methods are invoked in CNI using the standard C++ syntax,
|
2762 |
|
|
using the `::' operator rather than the `.' operator.
|
2763 |
|
|
|
2764 |
|
|
For example:
|
2765 |
|
|
|
2766 |
|
|
jint i = java::lang::Math::round((jfloat) 2.3);
|
2767 |
|
|
|
2768 |
|
|
C++ method definition syntax is used to define a static native method.
|
2769 |
|
|
For example:
|
2770 |
|
|
|
2771 |
|
|
#include
|
2772 |
|
|
java::lang::Integer*
|
2773 |
|
|
java::lang::Integer::getInteger(jstring str)
|
2774 |
|
|
{
|
2775 |
|
|
...
|
2776 |
|
|
}
|
2777 |
|
|
|
2778 |
|
|
11.11.3 Object Constructors
|
2779 |
|
|
---------------------------
|
2780 |
|
|
|
2781 |
|
|
Constructors are called implicitly as part of object allocation using
|
2782 |
|
|
the `new' operator.
|
2783 |
|
|
|
2784 |
|
|
For example:
|
2785 |
|
|
|
2786 |
|
|
java::lang::Integer *x = new java::lang::Integer(234);
|
2787 |
|
|
|
2788 |
|
|
Java does not allow a constructor to be a native method. This
|
2789 |
|
|
limitation can be coded round however because a constructor can _call_
|
2790 |
|
|
a native method.
|
2791 |
|
|
|
2792 |
|
|
11.11.4 Instance methods
|
2793 |
|
|
------------------------
|
2794 |
|
|
|
2795 |
|
|
Calling a Java instance method from a C++ CNI method is done using the
|
2796 |
|
|
standard C++ syntax, e.g.:
|
2797 |
|
|
|
2798 |
|
|
// First create the Java object.
|
2799 |
|
|
java::lang::Integer *x = new java::lang::Integer(234);
|
2800 |
|
|
// Now call a method.
|
2801 |
|
|
jint prim_value = x->intValue();
|
2802 |
|
|
if (x->longValue == 0)
|
2803 |
|
|
...
|
2804 |
|
|
|
2805 |
|
|
Defining a Java native instance method is also done the natural way:
|
2806 |
|
|
|
2807 |
|
|
#include
|
2808 |
|
|
|
2809 |
|
|
jdouble
|
2810 |
|
|
java::lang:Integer::doubleValue()
|
2811 |
|
|
{
|
2812 |
|
|
return (jdouble) value;
|
2813 |
|
|
}
|
2814 |
|
|
|
2815 |
|
|
11.11.5 Interface methods
|
2816 |
|
|
-------------------------
|
2817 |
|
|
|
2818 |
|
|
In Java you can call a method using an interface reference. This is
|
2819 |
|
|
supported, but not completely. *Note Interfaces::.
|
2820 |
|
|
|
2821 |
|
|
|
2822 |
|
|
File: gcj.info, Node: Strings, Next: Mixing with C++, Prev: Methods, Up: About CNI
|
2823 |
|
|
|
2824 |
|
|
11.12 Strings
|
2825 |
|
|
=============
|
2826 |
|
|
|
2827 |
|
|
CNI provides a number of utility functions for working with Java Java
|
2828 |
|
|
`String' objects. The names and interfaces are analogous to those of
|
2829 |
|
|
JNI.
|
2830 |
|
|
|
2831 |
|
|
-- Function: jstring JvNewString (const jchar* CHARS, jsize LEN)
|
2832 |
|
|
Returns a Java `String' object with characters from the array of
|
2833 |
|
|
Unicode characters CHARS up to the index LEN in that array.
|
2834 |
|
|
|
2835 |
|
|
-- Function: jstring JvNewStringLatin1 (const char* BYTES, jsize LEN)
|
2836 |
|
|
Returns a Java `String' made up of LEN bytes from BYTES.
|
2837 |
|
|
|
2838 |
|
|
-- Function: jstring JvNewStringLatin1 (const char* BYTES)
|
2839 |
|
|
As above but the length of the `String' is `strlen(BYTES)'.
|
2840 |
|
|
|
2841 |
|
|
-- Function: jstring JvNewStringUTF (const char* BYTES)
|
2842 |
|
|
Returns a `String' which is made up of the UTF encoded characters
|
2843 |
|
|
present in the C string BYTES.
|
2844 |
|
|
|
2845 |
|
|
-- Function: jchar* JvGetStringChars (jstring STR)
|
2846 |
|
|
Returns a pointer to an array of characters making up the `String'
|
2847 |
|
|
STR.
|
2848 |
|
|
|
2849 |
|
|
-- Function: int JvGetStringUTFLength (jstring STR)
|
2850 |
|
|
Returns the number of bytes required to encode the contents of the
|
2851 |
|
|
`String' STR in UTF-8.
|
2852 |
|
|
|
2853 |
|
|
-- Function: jsize JvGetStringUTFRegion (jstring STR, jsize START,
|
2854 |
|
|
jsize LEN, char* BUF)
|
2855 |
|
|
Puts the UTF-8 encoding of a region of the `String' STR into the
|
2856 |
|
|
buffer `buf'. The region to fetch is marked by START and LEN.
|
2857 |
|
|
|
2858 |
|
|
Note that BUF is a buffer, not a C string. It is _not_ null
|
2859 |
|
|
terminated.
|
2860 |
|
|
|
2861 |
|
|
|
2862 |
|
|
File: gcj.info, Node: Mixing with C++, Next: Exception Handling, Prev: Strings, Up: About CNI
|
2863 |
|
|
|
2864 |
|
|
11.13 Interoperating with C/C++
|
2865 |
|
|
===============================
|
2866 |
|
|
|
2867 |
|
|
Because CNI is designed to represent Java classes and methods it cannot
|
2868 |
|
|
be mixed readily with C/C++ types.
|
2869 |
|
|
|
2870 |
|
|
One important restriction is that Java classes cannot have non-Java
|
2871 |
|
|
type instance or static variables and cannot have methods which take
|
2872 |
|
|
non-Java types as arguments or return non-Java types.
|
2873 |
|
|
|
2874 |
|
|
None of the following is possible with CNI:
|
2875 |
|
|
|
2876 |
|
|
|
2877 |
|
|
class ::MyClass : public java::lang::Object
|
2878 |
|
|
{
|
2879 |
|
|
char* variable; // char* is not a valid Java type.
|
2880 |
|
|
}
|
2881 |
|
|
|
2882 |
|
|
|
2883 |
|
|
uint
|
2884 |
|
|
::SomeClass::someMethod (char *arg)
|
2885 |
|
|
{
|
2886 |
|
|
.
|
2887 |
|
|
.
|
2888 |
|
|
.
|
2889 |
|
|
} // `uint' is not a valid Java type, neither is `char*'
|
2890 |
|
|
|
2891 |
|
|
Of course, it is ok to use C/C++ types within the scope of a method:
|
2892 |
|
|
|
2893 |
|
|
jint
|
2894 |
|
|
::SomeClass::otherMethod (jstring str)
|
2895 |
|
|
{
|
2896 |
|
|
char *arg = ...
|
2897 |
|
|
.
|
2898 |
|
|
.
|
2899 |
|
|
.
|
2900 |
|
|
}
|
2901 |
|
|
|
2902 |
|
|
11.13.1 RawData
|
2903 |
|
|
---------------
|
2904 |
|
|
|
2905 |
|
|
The above restriction can be problematic, so CNI includes the
|
2906 |
|
|
`gnu.gcj.RawData' class. The `RawData' class is a "non-scanned
|
2907 |
|
|
reference" type. In other words variables declared of type `RawData'
|
2908 |
|
|
can contain any data and are not checked by the compiler or memory
|
2909 |
|
|
manager in any way.
|
2910 |
|
|
|
2911 |
|
|
This means that you can put C/C++ data structures (including classes)
|
2912 |
|
|
in your CNI classes, as long as you use the appropriate cast.
|
2913 |
|
|
|
2914 |
|
|
Here are some examples:
|
2915 |
|
|
|
2916 |
|
|
|
2917 |
|
|
class ::MyClass : public java::lang::Object
|
2918 |
|
|
{
|
2919 |
|
|
gnu.gcj.RawData string;
|
2920 |
|
|
|
2921 |
|
|
MyClass ();
|
2922 |
|
|
gnu.gcj.RawData getText ();
|
2923 |
|
|
void printText ();
|
2924 |
|
|
}
|
2925 |
|
|
|
2926 |
|
|
::MyClass::MyClass ()
|
2927 |
|
|
{
|
2928 |
|
|
char* text = ...
|
2929 |
|
|
string = text;
|
2930 |
|
|
}
|
2931 |
|
|
|
2932 |
|
|
gnu.gcj.RawData
|
2933 |
|
|
::MyClass::getText ()
|
2934 |
|
|
{
|
2935 |
|
|
return string;
|
2936 |
|
|
}
|
2937 |
|
|
|
2938 |
|
|
void
|
2939 |
|
|
::MyClass::printText ()
|
2940 |
|
|
{
|
2941 |
|
|
printf("%s\n", (char*) string);
|
2942 |
|
|
}
|
2943 |
|
|
|
2944 |
|
|
11.13.2 RawDataManaged
|
2945 |
|
|
----------------------
|
2946 |
|
|
|
2947 |
|
|
`gnu.gcj.RawDataManaged' is another type used to indicate special data
|
2948 |
|
|
used by native code. Unlike the `RawData' type, fields declared as
|
2949 |
|
|
`RawDataManaged' will be "marked" by the memory manager and considered
|
2950 |
|
|
for garbage collection.
|
2951 |
|
|
|
2952 |
|
|
Native data which is allocated using CNI's `JvAllocBytes()' function
|
2953 |
|
|
and stored in a `RawDataManaged' will be automatically freed when the
|
2954 |
|
|
Java object it is associated with becomes unreachable.
|
2955 |
|
|
|
2956 |
|
|
11.13.3 Native memory allocation
|
2957 |
|
|
--------------------------------
|
2958 |
|
|
|
2959 |
|
|
-- Function: void* JvAllocBytes (jsize SIZE)
|
2960 |
|
|
Allocates SIZE bytes from the heap. The memory returned is zeroed.
|
2961 |
|
|
This memory is not scanned for pointers by the garbage collector,
|
2962 |
|
|
but will be freed if no references to it are discovered.
|
2963 |
|
|
|
2964 |
|
|
This function can be useful if you need to associate some native
|
2965 |
|
|
data with a Java object. Using a CNI's special `RawDataManaged'
|
2966 |
|
|
type, native data allocated with `JvAllocBytes' will be
|
2967 |
|
|
automatically freed when the Java object itself becomes
|
2968 |
|
|
unreachable.
|
2969 |
|
|
|
2970 |
|
|
11.13.4 Posix signals
|
2971 |
|
|
---------------------
|
2972 |
|
|
|
2973 |
|
|
On Posix based systems the `libgcj' library uses several signals
|
2974 |
|
|
internally. CNI code should not attempt to use the same signals as
|
2975 |
|
|
doing so may cause `libgcj' and/or the CNI code to fail.
|
2976 |
|
|
|
2977 |
|
|
SIGSEGV is used on many systems to generate `NullPointerExceptions'.
|
2978 |
|
|
SIGCHLD is used internally by `Runtime.exec()'. Several other signals
|
2979 |
|
|
(that vary from platform to platform) can be used by the memory manager
|
2980 |
|
|
and by `Thread.interrupt()'.
|
2981 |
|
|
|
2982 |
|
|
|
2983 |
|
|
File: gcj.info, Node: Exception Handling, Next: Synchronization, Prev: Mixing with C++, Up: About CNI
|
2984 |
|
|
|
2985 |
|
|
11.14 Exception Handling
|
2986 |
|
|
========================
|
2987 |
|
|
|
2988 |
|
|
While C++ and Java share a common exception handling framework, things
|
2989 |
|
|
are not yet perfectly integrated. The main issue is that the run-time
|
2990 |
|
|
type information facilities of the two languages are not integrated.
|
2991 |
|
|
|
2992 |
|
|
Still, things work fairly well. You can throw a Java exception from
|
2993 |
|
|
C++ using the ordinary `throw' construct, and this exception can be
|
2994 |
|
|
caught by Java code. Similarly, you can catch an exception thrown from
|
2995 |
|
|
Java using the C++ `catch' construct.
|
2996 |
|
|
|
2997 |
|
|
Here is an example:
|
2998 |
|
|
|
2999 |
|
|
if (i >= count)
|
3000 |
|
|
throw new java::lang::IndexOutOfBoundsException();
|
3001 |
|
|
|
3002 |
|
|
Normally, G++ will automatically detect when you are writing C++
|
3003 |
|
|
code that uses Java exceptions, and handle them appropriately.
|
3004 |
|
|
However, if C++ code only needs to execute destructors when Java
|
3005 |
|
|
exceptions are thrown through it, GCC will guess incorrectly. Sample
|
3006 |
|
|
problematic code:
|
3007 |
|
|
|
3008 |
|
|
struct S { ~S(); };
|
3009 |
|
|
|
3010 |
|
|
extern void bar(); // Is implemented in Java and may throw exceptions.
|
3011 |
|
|
|
3012 |
|
|
void foo()
|
3013 |
|
|
{
|
3014 |
|
|
S s;
|
3015 |
|
|
bar();
|
3016 |
|
|
}
|
3017 |
|
|
|
3018 |
|
|
The usual effect of an incorrect guess is a link failure,
|
3019 |
|
|
complaining of a missing routine called `__gxx_personality_v0'.
|
3020 |
|
|
|
3021 |
|
|
You can inform the compiler that Java exceptions are to be used in a
|
3022 |
|
|
translation unit, irrespective of what it might think, by writing
|
3023 |
|
|
`#pragma GCC java_exceptions' at the head of the file. This `#pragma'
|
3024 |
|
|
must appear before any functions that throw or catch exceptions, or run
|
3025 |
|
|
destructors when exceptions are thrown through them.
|
3026 |
|
|
|
3027 |
|
|
|
3028 |
|
|
File: gcj.info, Node: Synchronization, Next: Invocation, Prev: Exception Handling, Up: About CNI
|
3029 |
|
|
|
3030 |
|
|
11.15 Synchronization
|
3031 |
|
|
=====================
|
3032 |
|
|
|
3033 |
|
|
Each Java object has an implicit monitor. The Java VM uses the
|
3034 |
|
|
instruction `monitorenter' to acquire and lock a monitor, and
|
3035 |
|
|
`monitorexit' to release it.
|
3036 |
|
|
|
3037 |
|
|
The corresponding CNI macros are `JvMonitorEnter' and
|
3038 |
|
|
`JvMonitorExit' (JNI has similar methods `MonitorEnter' and
|
3039 |
|
|
`MonitorExit').
|
3040 |
|
|
|
3041 |
|
|
The Java source language does not provide direct access to these
|
3042 |
|
|
primitives. Instead, there is a `synchronized' statement that does an
|
3043 |
|
|
implicit `monitorenter' before entry to the block, and does a
|
3044 |
|
|
`monitorexit' on exit from the block. Note that the lock has to be
|
3045 |
|
|
released even when the block is abnormally terminated by an exception,
|
3046 |
|
|
which means there is an implicit `try finally' surrounding
|
3047 |
|
|
synchronization locks.
|
3048 |
|
|
|
3049 |
|
|
From C++, it makes sense to use a destructor to release a lock. CNI
|
3050 |
|
|
defines the following utility class:
|
3051 |
|
|
|
3052 |
|
|
class JvSynchronize() {
|
3053 |
|
|
jobject obj;
|
3054 |
|
|
JvSynchronize(jobject o) { obj = o; JvMonitorEnter(o); }
|
3055 |
|
|
~JvSynchronize() { JvMonitorExit(obj); }
|
3056 |
|
|
};
|
3057 |
|
|
|
3058 |
|
|
So this Java code:
|
3059 |
|
|
|
3060 |
|
|
synchronized (OBJ)
|
3061 |
|
|
{
|
3062 |
|
|
CODE
|
3063 |
|
|
}
|
3064 |
|
|
|
3065 |
|
|
might become this C++ code:
|
3066 |
|
|
|
3067 |
|
|
{
|
3068 |
|
|
JvSynchronize dummy (OBJ);
|
3069 |
|
|
CODE;
|
3070 |
|
|
}
|
3071 |
|
|
|
3072 |
|
|
Java also has methods with the `synchronized' attribute. This is
|
3073 |
|
|
equivalent to wrapping the entire method body in a `synchronized'
|
3074 |
|
|
statement. (Alternatively, an implementation could require the caller
|
3075 |
|
|
to do the synchronization. This is not practical for a compiler,
|
3076 |
|
|
because each virtual method call would have to test at run-time if
|
3077 |
|
|
synchronization is needed.) Since in `gcj' the `synchronized'
|
3078 |
|
|
attribute is handled by the method implementation, it is up to the
|
3079 |
|
|
programmer of a synchronized native method to handle the synchronization
|
3080 |
|
|
(in the C++ implementation of the method). In other words, you need to
|
3081 |
|
|
manually add `JvSynchronize' in a `native synchronized' method.
|
3082 |
|
|
|
3083 |
|
|
|
3084 |
|
|
File: gcj.info, Node: Invocation, Next: Reflection, Prev: Synchronization, Up: About CNI
|
3085 |
|
|
|
3086 |
|
|
11.16 Invocation
|
3087 |
|
|
================
|
3088 |
|
|
|
3089 |
|
|
CNI permits C++ applications to make calls into Java classes, in
|
3090 |
|
|
addition to allowing Java code to call into C++. Several functions,
|
3091 |
|
|
known as the "invocation API", are provided to support this.
|
3092 |
|
|
|
3093 |
|
|
-- Function: jint JvCreateJavaVM (JvVMInitArgs* VM_ARGS)
|
3094 |
|
|
Initializes the Java runtime. This function performs essential
|
3095 |
|
|
initialization of the threads interface, garbage collector,
|
3096 |
|
|
exception handling and other key aspects of the runtime. It must
|
3097 |
|
|
be called once by an application with a non-Java `main()'
|
3098 |
|
|
function, before any other Java or CNI calls are made. It is
|
3099 |
|
|
safe, but not recommended, to call `JvCreateJavaVM()' more than
|
3100 |
|
|
once provided it is only called from a single thread. The VMARGS
|
3101 |
|
|
parameter can be used to specify initialization parameters for the
|
3102 |
|
|
Java runtime. It may be `NULL'.
|
3103 |
|
|
|
3104 |
|
|
JvVMInitArgs represents a list of virtual machine initialization
|
3105 |
|
|
arguments. `JvCreateJavaVM()' ignores the version field.
|
3106 |
|
|
|
3107 |
|
|
typedef struct JvVMOption
|
3108 |
|
|
{
|
3109 |
|
|
// a VM initialization option
|
3110 |
|
|
char* optionString;
|
3111 |
|
|
// extra information associated with this option
|
3112 |
|
|
void* extraInfo;
|
3113 |
|
|
} JvVMOption;
|
3114 |
|
|
|
3115 |
|
|
typedef struct JvVMInitArgs
|
3116 |
|
|
{
|
3117 |
|
|
// for compatibility with JavaVMInitArgs
|
3118 |
|
|
jint version;
|
3119 |
|
|
|
3120 |
|
|
// number of VM initialization options
|
3121 |
|
|
jint nOptions;
|
3122 |
|
|
|
3123 |
|
|
// an array of VM initialization options
|
3124 |
|
|
JvVMOption* options;
|
3125 |
|
|
|
3126 |
|
|
// true if the option parser should ignore unrecognized options
|
3127 |
|
|
jboolean ignoreUnrecognized;
|
3128 |
|
|
} JvVMInitArgs;
|
3129 |
|
|
|
3130 |
|
|
`JvCreateJavaVM()' returns `0' upon success, or `-1' if the
|
3131 |
|
|
runtime is already initialized.
|
3132 |
|
|
|
3133 |
|
|
_Note:_ In GCJ 3.1, the `vm_args' parameter is ignored. It is
|
3134 |
|
|
recognized and used as of release 4.0.
|
3135 |
|
|
|
3136 |
|
|
-- Function: java::lang::Thread* JvAttachCurrentThread (jstring NAME,
|
3137 |
|
|
java::lang::ThreadGroup* GROUP)
|
3138 |
|
|
Registers an existing thread with the Java runtime. This must be
|
3139 |
|
|
called once from each thread, before that thread makes any other
|
3140 |
|
|
Java or CNI calls. It must be called after `JvCreateJavaVM'. NAME
|
3141 |
|
|
specifies a name for the thread. It may be `NULL', in which case a
|
3142 |
|
|
name will be generated. GROUP is the ThreadGroup in which this
|
3143 |
|
|
thread will be a member. If it is `NULL', the thread will be a
|
3144 |
|
|
member of the main thread group. The return value is the Java
|
3145 |
|
|
`Thread' object that represents the thread. It is safe to call
|
3146 |
|
|
`JvAttachCurrentThread()' more than once from the same thread. If
|
3147 |
|
|
the thread is already attached, the call is ignored and the current
|
3148 |
|
|
thread object is returned.
|
3149 |
|
|
|
3150 |
|
|
-- Function: jint JvDetachCurrentThread ()
|
3151 |
|
|
Unregisters a thread from the Java runtime. This should be called
|
3152 |
|
|
by threads that were attached using `JvAttachCurrentThread()',
|
3153 |
|
|
after they have finished making calls to Java code. This ensures
|
3154 |
|
|
that any resources associated with the thread become eligible for
|
3155 |
|
|
garbage collection. This function returns `0' upon success, or
|
3156 |
|
|
`-1' if the current thread is not attached.
|
3157 |
|
|
|
3158 |
|
|
11.16.1 Handling uncaught exceptions
|
3159 |
|
|
------------------------------------
|
3160 |
|
|
|
3161 |
|
|
If an exception is thrown from Java code called using the invocation
|
3162 |
|
|
API, and no handler for the exception can be found, the runtime will
|
3163 |
|
|
abort the application. In order to make the application more robust, it
|
3164 |
|
|
is recommended that code which uses the invocation API be wrapped by a
|
3165 |
|
|
top-level try/catch block that catches all Java exceptions.
|
3166 |
|
|
|
3167 |
|
|
11.16.2 Example
|
3168 |
|
|
---------------
|
3169 |
|
|
|
3170 |
|
|
The following code demonstrates the use of the invocation API. In this
|
3171 |
|
|
example, the C++ application initializes the Java runtime and attaches
|
3172 |
|
|
itself. The `java.lang.System' class is initialized in order to access
|
3173 |
|
|
its `out' field, and a Java string is printed. Finally, the thread is
|
3174 |
|
|
detached from the runtime once it has finished making Java calls.
|
3175 |
|
|
Everything is wrapped with a try/catch block to provide a default
|
3176 |
|
|
handler for any uncaught exceptions.
|
3177 |
|
|
|
3178 |
|
|
The example can be compiled with `c++ -c test.cc; gcj test.o'.
|
3179 |
|
|
|
3180 |
|
|
// test.cc
|
3181 |
|
|
#include
|
3182 |
|
|
#include
|
3183 |
|
|
#include
|
3184 |
|
|
#include
|
3185 |
|
|
|
3186 |
|
|
int main(int argc, char *argv[])
|
3187 |
|
|
{
|
3188 |
|
|
using namespace java::lang;
|
3189 |
|
|
|
3190 |
|
|
try
|
3191 |
|
|
{
|
3192 |
|
|
JvCreateJavaVM(NULL);
|
3193 |
|
|
JvAttachCurrentThread(NULL, NULL);
|
3194 |
|
|
|
3195 |
|
|
String *message = JvNewStringLatin1("Hello from C++");
|
3196 |
|
|
JvInitClass(&System::class$);
|
3197 |
|
|
System::out->println(message);
|
3198 |
|
|
|
3199 |
|
|
JvDetachCurrentThread();
|
3200 |
|
|
}
|
3201 |
|
|
catch (Throwable *t)
|
3202 |
|
|
{
|
3203 |
|
|
System::err->println(JvNewStringLatin1("Unhandled Java exception:"));
|
3204 |
|
|
t->printStackTrace();
|
3205 |
|
|
}
|
3206 |
|
|
}
|
3207 |
|
|
|
3208 |
|
|
|
3209 |
|
|
File: gcj.info, Node: Reflection, Prev: Invocation, Up: About CNI
|
3210 |
|
|
|
3211 |
|
|
11.17 Reflection
|
3212 |
|
|
================
|
3213 |
|
|
|
3214 |
|
|
Reflection is possible with CNI code, it functions similarly to how it
|
3215 |
|
|
functions with JNI.
|
3216 |
|
|
|
3217 |
|
|
The types `jfieldID' and `jmethodID' are as in JNI.
|
3218 |
|
|
|
3219 |
|
|
The functions:
|
3220 |
|
|
|
3221 |
|
|
* `JvFromReflectedField',
|
3222 |
|
|
|
3223 |
|
|
* `JvFromReflectedMethod',
|
3224 |
|
|
|
3225 |
|
|
* `JvToReflectedField'
|
3226 |
|
|
|
3227 |
|
|
* `JvToFromReflectedMethod'
|
3228 |
|
|
|
3229 |
|
|
will be added shortly, as will other functions corresponding to JNI.
|
3230 |
|
|
|
3231 |
|
|
|
3232 |
|
|
File: gcj.info, Node: System properties, Next: Resources, Prev: About CNI, Up: Top
|
3233 |
|
|
|
3234 |
|
|
12 System properties
|
3235 |
|
|
********************
|
3236 |
|
|
|
3237 |
|
|
The runtime behavior of the `libgcj' library can be modified by setting
|
3238 |
|
|
certain system properties. These properties can be compiled into the
|
3239 |
|
|
program using the `-DNAME[=VALUE]' option to `gcj' or by setting them
|
3240 |
|
|
explicitly in the program by calling the
|
3241 |
|
|
`java.lang.System.setProperty()' method. Some system properties are
|
3242 |
|
|
only used for informational purposes (like giving a version number or a
|
3243 |
|
|
user name). A program can inspect the current value of a property by
|
3244 |
|
|
calling the `java.lang.System.getProperty()' method.
|
3245 |
|
|
|
3246 |
|
|
* Menu:
|
3247 |
|
|
|
3248 |
|
|
* Standard Properties:: Standard properties supported by `libgcj'
|
3249 |
|
|
* GNU Classpath Properties:: Properties found in Classpath based libraries
|
3250 |
|
|
* libgcj Runtime Properties:: Properties specific to `libgcj'
|
3251 |
|
|
|
3252 |
|
|
|
3253 |
|
|
File: gcj.info, Node: Standard Properties, Next: GNU Classpath Properties, Up: System properties
|
3254 |
|
|
|
3255 |
|
|
12.1 Standard Properties
|
3256 |
|
|
========================
|
3257 |
|
|
|
3258 |
|
|
The following properties are normally found in all implementations of
|
3259 |
|
|
the core libraries for the Java language.
|
3260 |
|
|
|
3261 |
|
|
`java.version'
|
3262 |
|
|
The `libgcj' version number.
|
3263 |
|
|
|
3264 |
|
|
`java.vendor'
|
3265 |
|
|
Set to `The Free Software Foundation, Inc.'
|
3266 |
|
|
|
3267 |
|
|
`java.vendor.url'
|
3268 |
|
|
Set to `http://gcc.gnu.org/java/'.
|
3269 |
|
|
|
3270 |
|
|
`java.home'
|
3271 |
|
|
The directory where `gcj' was installed. Taken from the `--prefix'
|
3272 |
|
|
option given to `configure'.
|
3273 |
|
|
|
3274 |
|
|
`java.class.version'
|
3275 |
|
|
The class format version number supported by the libgcj byte code
|
3276 |
|
|
interpreter. (Currently `46.0')
|
3277 |
|
|
|
3278 |
|
|
`java.vm.specification.version'
|
3279 |
|
|
The Virtual Machine Specification version implemented by `libgcj'.
|
3280 |
|
|
(Currently `1.0')
|
3281 |
|
|
|
3282 |
|
|
`java.vm.specification.vendor'
|
3283 |
|
|
The name of the Virtual Machine specification designer.
|
3284 |
|
|
|
3285 |
|
|
`java.vm.specification.name'
|
3286 |
|
|
The name of the Virtual Machine specification (Set to `Java
|
3287 |
|
|
Virtual Machine Specification').
|
3288 |
|
|
|
3289 |
|
|
`java.vm.version'
|
3290 |
|
|
The `gcj' version number.
|
3291 |
|
|
|
3292 |
|
|
`java.vm.vendor'
|
3293 |
|
|
Set to `The Free Software Foundation, Inc.'
|
3294 |
|
|
|
3295 |
|
|
`java.vm.name'
|
3296 |
|
|
Set to `GNU libgcj'.
|
3297 |
|
|
|
3298 |
|
|
`java.specification.version'
|
3299 |
|
|
The Runtime Environment specification version implemented by
|
3300 |
|
|
`libgcj'. (Currently set to `1.3')
|
3301 |
|
|
|
3302 |
|
|
`java.specification.vendor'
|
3303 |
|
|
The Runtime Environment specification designer.
|
3304 |
|
|
|
3305 |
|
|
`java.specification.name'
|
3306 |
|
|
The name of the Runtime Environment specification (Set to `Java
|
3307 |
|
|
Platform API Specification').
|
3308 |
|
|
|
3309 |
|
|
`java.class.path'
|
3310 |
|
|
The paths (jar files, zip files and directories) used for finding
|
3311 |
|
|
class files.
|
3312 |
|
|
|
3313 |
|
|
`java.library.path'
|
3314 |
|
|
Directory path used for finding native libraries.
|
3315 |
|
|
|
3316 |
|
|
`java.io.tmpdir'
|
3317 |
|
|
The directory used to put temporary files in.
|
3318 |
|
|
|
3319 |
|
|
`java.compiler'
|
3320 |
|
|
Name of the Just In Time compiler to use by the byte code
|
3321 |
|
|
interpreter. Currently not used in `libgcj'.
|
3322 |
|
|
|
3323 |
|
|
`java.ext.dirs'
|
3324 |
|
|
Directories containing jar files with extra libraries. Will be
|
3325 |
|
|
used when resolving classes.
|
3326 |
|
|
|
3327 |
|
|
`java.protocol.handler.pkgs'
|
3328 |
|
|
A `|' separated list of package names that is used to find classes
|
3329 |
|
|
that implement handlers for `java.net.URL'.
|
3330 |
|
|
|
3331 |
|
|
`java.rmi.server.codebase'
|
3332 |
|
|
A list of URLs that is used by the `java.rmi.server.RMIClassLoader'
|
3333 |
|
|
to load classes from.
|
3334 |
|
|
|
3335 |
|
|
`jdbc.drivers'
|
3336 |
|
|
A list of class names that will be loaded by the
|
3337 |
|
|
`java.sql.DriverManager' when it starts up.
|
3338 |
|
|
|
3339 |
|
|
`file.separator'
|
3340 |
|
|
The separator used in when directories are included in a filename
|
3341 |
|
|
(normally `/' or `\' ).
|
3342 |
|
|
|
3343 |
|
|
`file.encoding'
|
3344 |
|
|
The default character encoding used when converting platform
|
3345 |
|
|
native files to Unicode (usually set to `8859_1').
|
3346 |
|
|
|
3347 |
|
|
`path.separator'
|
3348 |
|
|
The standard separator used when a string contains multiple paths
|
3349 |
|
|
(normally `:' or `;'), the string is usually not a valid character
|
3350 |
|
|
to use in normal directory names.)
|
3351 |
|
|
|
3352 |
|
|
`line.separator'
|
3353 |
|
|
The default line separator used on the platform (normally `\n',
|
3354 |
|
|
`\r' or a combination of those two characters).
|
3355 |
|
|
|
3356 |
|
|
`policy.provider'
|
3357 |
|
|
The class name used for the default policy provider returned by
|
3358 |
|
|
`java.security.Policy.getPolicy'.
|
3359 |
|
|
|
3360 |
|
|
`user.name'
|
3361 |
|
|
The name of the user running the program. Can be the full name,
|
3362 |
|
|
the login name or empty if unknown.
|
3363 |
|
|
|
3364 |
|
|
`user.home'
|
3365 |
|
|
The default directory to put user specific files in.
|
3366 |
|
|
|
3367 |
|
|
`user.dir'
|
3368 |
|
|
The current working directory from which the program was started.
|
3369 |
|
|
|
3370 |
|
|
`user.language'
|
3371 |
|
|
The default language as used by the `java.util.Locale' class.
|
3372 |
|
|
|
3373 |
|
|
`user.region'
|
3374 |
|
|
The default region as used by the `java.util.Local' class.
|
3375 |
|
|
|
3376 |
|
|
`user.variant'
|
3377 |
|
|
The default variant of the language and region local used.
|
3378 |
|
|
|
3379 |
|
|
`user.timezone'
|
3380 |
|
|
The default timezone as used by the `java.util.TimeZone' class.
|
3381 |
|
|
|
3382 |
|
|
`os.name'
|
3383 |
|
|
The operating system/kernel name that the program runs on.
|
3384 |
|
|
|
3385 |
|
|
`os.arch'
|
3386 |
|
|
The hardware that we are running on.
|
3387 |
|
|
|
3388 |
|
|
`os.version'
|
3389 |
|
|
The version number of the operating system/kernel.
|
3390 |
|
|
|
3391 |
|
|
`awt.appletWarning'
|
3392 |
|
|
The string to display when an untrusted applet is displayed.
|
3393 |
|
|
Returned by `java.awt.Window.getWarningString()' when the window is
|
3394 |
|
|
"insecure".
|
3395 |
|
|
|
3396 |
|
|
`awt.toolkit'
|
3397 |
|
|
The class name used for initializing the default
|
3398 |
|
|
`java.awt.Toolkit'. Defaults to `gnu.awt.gtk.GtkToolkit'.
|
3399 |
|
|
|
3400 |
|
|
`http.proxyHost'
|
3401 |
|
|
Name of proxy host for http connections.
|
3402 |
|
|
|
3403 |
|
|
`http.proxyPort'
|
3404 |
|
|
Port number to use when a proxy host is in use.
|
3405 |
|
|
|
3406 |
|
|
|
3407 |
|
|
|
3408 |
|
|
File: gcj.info, Node: GNU Classpath Properties, Next: libgcj Runtime Properties, Prev: Standard Properties, Up: System properties
|
3409 |
|
|
|
3410 |
|
|
12.2 GNU Classpath Properties
|
3411 |
|
|
=============================
|
3412 |
|
|
|
3413 |
|
|
`libgcj' is based on the GNU Classpath (Essential Libraries for Java) a
|
3414 |
|
|
GNU project to create free core class libraries for use with virtual
|
3415 |
|
|
machines and compilers for the Java language. The following properties
|
3416 |
|
|
are common to libraries based on GNU Classpath.
|
3417 |
|
|
|
3418 |
|
|
`gcj.dumpobject'
|
3419 |
|
|
Enables printing serialization debugging by the
|
3420 |
|
|
`java.io.ObjectInput' and `java.io.ObjectOutput' classes when set
|
3421 |
|
|
to something else then the empty string. Only used when running a
|
3422 |
|
|
debug build of the library.
|
3423 |
|
|
|
3424 |
|
|
`gnu.classpath.vm.shortname'
|
3425 |
|
|
This is a succinct name of the virtual machine. For `libgcj',
|
3426 |
|
|
this will always be `libgcj'.
|
3427 |
|
|
|
3428 |
|
|
`gnu.classpath.home.url'
|
3429 |
|
|
A base URL used for finding system property files (e.g.,
|
3430 |
|
|
`classpath.security'). By default this is a `file:' URL pointing
|
3431 |
|
|
to the `lib' directory under `java.home'.
|
3432 |
|
|
|
3433 |
|
|
|
3434 |
|
|
|
3435 |
|
|
File: gcj.info, Node: libgcj Runtime Properties, Prev: GNU Classpath Properties, Up: System properties
|
3436 |
|
|
|
3437 |
|
|
12.3 libgcj Runtime Properties
|
3438 |
|
|
==============================
|
3439 |
|
|
|
3440 |
|
|
The following properties are specific to the `libgcj' runtime and will
|
3441 |
|
|
normally not be found in other core libraries for the java language.
|
3442 |
|
|
|
3443 |
|
|
`java.fullversion'
|
3444 |
|
|
The combination of `java.vm.name' and `java.vm.version'.
|
3445 |
|
|
|
3446 |
|
|
`java.vm.info'
|
3447 |
|
|
Same as `java.fullversion'.
|
3448 |
|
|
|
3449 |
|
|
`impl.prefix'
|
3450 |
|
|
Used by the `java.net.DatagramSocket' class when set to something
|
3451 |
|
|
else then the empty string. When set all newly created
|
3452 |
|
|
`DatagramSocket's will try to load a class
|
3453 |
|
|
`java.net.[impl.prefix]DatagramSocketImpl' instead of the normal
|
3454 |
|
|
`java.net.PlainDatagramSocketImpl'.
|
3455 |
|
|
|
3456 |
|
|
`gnu.gcj.progname'
|
3457 |
|
|
The class or binary name that was used to invoke the program. This
|
3458 |
|
|
will be the name of the "main" class in the case where the `gij'
|
3459 |
|
|
front end is used, or the program binary name in the case where an
|
3460 |
|
|
application is compiled to a native binary.
|
3461 |
|
|
|
3462 |
|
|
`gnu.gcj.user.realname'
|
3463 |
|
|
The real name of the user, as taken from the password file. This
|
3464 |
|
|
may not always hold only the user's name (as some sites put extra
|
3465 |
|
|
information in this field). Also, this property is not available
|
3466 |
|
|
on all platforms.
|
3467 |
|
|
|
3468 |
|
|
`gnu.gcj.runtime.NameFinder.use_addr2line'
|
3469 |
|
|
Whether an external process, `addr2line', should be used to
|
3470 |
|
|
determine line number information when tracing the stack. Setting
|
3471 |
|
|
this to `false' may suppress line numbers when printing stack
|
3472 |
|
|
traces and when using the java.util.logging infrastructure.
|
3473 |
|
|
However, performance may improve significantly for applications
|
3474 |
|
|
that print stack traces or make logging calls frequently.
|
3475 |
|
|
|
3476 |
|
|
`gnu.gcj.runtime.NameFinder.show_raw'
|
3477 |
|
|
Whether the address of a stack frame should be printed when the
|
3478 |
|
|
line number is unavailable. Setting this to `true' will cause the
|
3479 |
|
|
name of the object and the offset within that object to be printed
|
3480 |
|
|
when no line number is available. This allows for off-line
|
3481 |
|
|
decoding of stack traces if necessary debug information is
|
3482 |
|
|
available. The default is `false', no raw addresses are printed.
|
3483 |
|
|
|
3484 |
|
|
`gnu.gcj.runtime.NameFinder.remove_unknown'
|
3485 |
|
|
Whether stack frames for non-java code should be included in a
|
3486 |
|
|
stack trace. The default value is `true', stack frames for
|
3487 |
|
|
non-java code are suppressed. Setting this to `false' will cause
|
3488 |
|
|
any non-java stack frames to be printed in addition to frames for
|
3489 |
|
|
the java code.
|
3490 |
|
|
|
3491 |
|
|
`gnu.gcj.runtime.VMClassLoader.library_control'
|
3492 |
|
|
This controls how shared libraries are automatically loaded by the
|
3493 |
|
|
built-in class loader. If this property is set to `full', a full
|
3494 |
|
|
search is done for each requested class. If this property is set
|
3495 |
|
|
to `cache', then any failed lookups are cached and not tried again.
|
3496 |
|
|
If this property is set to `never' (the default), then lookups are
|
3497 |
|
|
never done. For more information, *Note Extensions::.
|
3498 |
|
|
|
3499 |
|
|
`gnu.gcj.runtime.endorsed.dirs'
|
3500 |
|
|
This is like the standard `java.endorsed.dirs', property, but
|
3501 |
|
|
specifies some extra directories which are searched after the
|
3502 |
|
|
standard endorsed directories. This is primarily useful for
|
3503 |
|
|
telling `libgcj' about additional libraries which are ordinarily
|
3504 |
|
|
incorporated into the JDK, and which should be loaded by the
|
3505 |
|
|
bootstrap class loader, but which are not yet part of `libgcj'
|
3506 |
|
|
itself for some reason.
|
3507 |
|
|
|
3508 |
|
|
`gnu.gcj.jit.compiler'
|
3509 |
|
|
This is the full path to `gcj' executable which should be used to
|
3510 |
|
|
compile classes just-in-time when `ClassLoader.defineClass' is
|
3511 |
|
|
called. If not set, `gcj' will not be invoked by the runtime;
|
3512 |
|
|
this can also be controlled via `Compiler.disable'.
|
3513 |
|
|
|
3514 |
|
|
`gnu.gcj.jit.options'
|
3515 |
|
|
This is a space-separated string of options which should be passed
|
3516 |
|
|
to `gcj' when in JIT mode. If not set, a sensible default is
|
3517 |
|
|
chosen.
|
3518 |
|
|
|
3519 |
|
|
`gnu.gcj.jit.cachedir'
|
3520 |
|
|
This is the directory where cached shared library files are
|
3521 |
|
|
stored. If not set, JIT compilation is disabled. This should
|
3522 |
|
|
never be set to a directory that is writable by any other user.
|
3523 |
|
|
|
3524 |
|
|
`gnu.gcj.precompiled.db.path'
|
3525 |
|
|
This is a sequence of file names, each referring to a file created
|
3526 |
|
|
by `gcj-dbtool'. These files will be used by `libgcj' to find
|
3527 |
|
|
shared libraries corresponding to classes that are loaded from
|
3528 |
|
|
bytecode. `libgcj' often has a built-in default database; it can
|
3529 |
|
|
be queried using `gcj-dbtool -p'.
|
3530 |
|
|
|
3531 |
|
|
|
3532 |
|
|
|
3533 |
|
|
File: gcj.info, Node: Resources, Next: Index, Prev: System properties, Up: Top
|
3534 |
|
|
|
3535 |
|
|
13 Resources
|
3536 |
|
|
************
|
3537 |
|
|
|
3538 |
|
|
While writing `gcj' and `libgcj' we have, of course, relied heavily on
|
3539 |
|
|
documentation from Sun Microsystems. In particular we have used The
|
3540 |
|
|
Java Language Specification (both first and second editions), the Java
|
3541 |
|
|
Class Libraries (volumes one and two), and the Java Virtual Machine
|
3542 |
|
|
Specification. In addition we've used the online documentation at
|
3543 |
|
|
`http://java.sun.com/'.
|
3544 |
|
|
|
3545 |
|
|
The current `gcj' home page is `http://gcc.gnu.org/java/'.
|
3546 |
|
|
|
3547 |
|
|
For more information on gcc, see `http://gcc.gnu.org/'.
|
3548 |
|
|
|
3549 |
|
|
Some `libgcj' testing is done using the Mauve test suite. This is a
|
3550 |
|
|
free software Java class library test suite which is being written
|
3551 |
|
|
because the JCK is not free. See `http://sources.redhat.com/mauve/'
|
3552 |
|
|
for more information.
|
3553 |
|
|
|
3554 |
|
|
|
3555 |
|
|
File: gcj.info, Node: Index, Prev: Resources, Up: Top
|
3556 |
|
|
|
3557 |
|
|
Index
|
3558 |
|
|
*****
|
3559 |
|
|
|
3560 |
|
|
|
3561 |
|
|
* Menu:
|
3562 |
|
|
|
3563 |
|
|
* class path: Input Options. (line 6)
|
3564 |
|
|
* class$: Reference types. (line 20)
|
3565 |
|
|
* elements on template: Arrays. (line 46)
|
3566 |
|
|
* FDL, GNU Free Documentation License: GNU Free Documentation License.
|
3567 |
|
|
(line 6)
|
3568 |
|
|
* GCJ_PROPERTIES: Extensions. (line 56)
|
3569 |
|
|
* jclass: Reference types. (line 16)
|
3570 |
|
|
* jobject: Reference types. (line 16)
|
3571 |
|
|
* jstring: Reference types. (line 16)
|
3572 |
|
|
* JvAllocBytes: Mixing with C++. (line 99)
|
3573 |
|
|
* JvAttachCurrentThread: Invocation. (line 55)
|
3574 |
|
|
* JvCreateJavaVM: Invocation. (line 11)
|
3575 |
|
|
* JvDetachCurrentThread: Invocation. (line 68)
|
3576 |
|
|
* JvFree: Memory allocation. (line 19)
|
3577 |
|
|
* JvGetArrayLength: Arrays. (line 86)
|
3578 |
|
|
* JvGetStringChars: Strings. (line 25)
|
3579 |
|
|
* JvGetStringUTFLength: Strings. (line 29)
|
3580 |
|
|
* JvGetStringUTFRegion: Strings. (line 34)
|
3581 |
|
|
* JvMalloc: Memory allocation. (line 11)
|
3582 |
|
|
* JvNewBooleanArray: Arrays. (line 83)
|
3583 |
|
|
* JvNewObjectArray: Arrays. (line 57)
|
3584 |
|
|
* JvNewString: Strings. (line 11)
|
3585 |
|
|
* JvNewStringLatin1: Strings. (line 15)
|
3586 |
|
|
|
3587 |
|
|
|
3588 |
|
|
* JvRealloc: Memory allocation. (line 15)
|
3589 |
|
|
|
3590 |
|
|
|
3591 |
|
|
|
3592 |
|
|
Tag Table:
|
3593 |
|
|
Node: Top2803
|
3594 |
|
|
Node: Copying4222
|
3595 |
|
|
Node: GNU Free Documentation License41772
|
3596 |
|
|
Node: Invoking gcj64184
|
3597 |
|
|
Node: Input and output files64947
|
3598 |
|
|
Node: Input Options66473
|
3599 |
|
|
Node: Encodings69747
|
3600 |
|
|
Node: Warnings70953
|
3601 |
|
|
Node: Linking72066
|
3602 |
|
|
Node: Code Generation75005
|
3603 |
|
|
Node: Configure-time Options81785
|
3604 |
|
|
Node: Compatibility83525
|
3605 |
|
|
Node: Limitations84009
|
3606 |
|
|
Node: Extensions85591
|
3607 |
|
|
Node: Invoking jcf-dump88685
|
3608 |
|
|
Node: Invoking gij89630
|
3609 |
|
|
Node: Invoking gcj-dbtool92881
|
3610 |
|
|
Node: Invoking jv-convert95347
|
3611 |
|
|
Node: Invoking grmic96426
|
3612 |
|
|
Node: Invoking gc-analyze97812
|
3613 |
|
|
Node: Invoking aot-compile99253
|
3614 |
|
|
Node: Invoking rebuild-gcj-db100202
|
3615 |
|
|
Node: About CNI100512
|
3616 |
|
|
Node: Basic concepts101971
|
3617 |
|
|
Node: Packages104867
|
3618 |
|
|
Node: Primitive types107195
|
3619 |
|
|
Node: Reference types108873
|
3620 |
|
|
Node: Interfaces109962
|
3621 |
|
|
Node: Objects and Classes110873
|
3622 |
|
|
Node: Class Initialization113068
|
3623 |
|
|
Node: Object allocation115410
|
3624 |
|
|
Node: Memory allocation116200
|
3625 |
|
|
Node: Arrays116832
|
3626 |
|
|
Node: Methods119642
|
3627 |
|
|
Node: Strings122463
|
3628 |
|
|
Node: Mixing with C++123967
|
3629 |
|
|
Node: Exception Handling127438
|
3630 |
|
|
Node: Synchronization129072
|
3631 |
|
|
Node: Invocation131062
|
3632 |
|
|
Node: Reflection135998
|
3633 |
|
|
Node: System properties136459
|
3634 |
|
|
Node: Standard Properties137336
|
3635 |
|
|
Node: GNU Classpath Properties141768
|
3636 |
|
|
Node: libgcj Runtime Properties142815
|
3637 |
|
|
Node: Resources147317
|