Code Generation
===============
In addition to the many `gcc' options controlling code generation,
`gcj' has several options specific to itself.
`--main=CLASSNAME'
This option is used when linking to specify the name of the class
whose `main' method should be invoked when the resulting
executable is run. (1)
`-DNAME[=VALUE]'
This option can only be used with `--main'. It defines a system
property named NAME with value VALUE. If VALUE is not specified
then it defaults to the empty string. These system properties are
initialized at the program's startup and can be retrieved at
runtime using the `java.lang.System.getProperty' method.
`-C'
This option is used to tell `gcj' to generate bytecode (`.class'
files) rather than object code.
`-d DIRECTORY'
When used with `-C', this causes all generated `.class' files to
be put in the appropriate subdirectory of DIRECTORY. By default
they will be put in subdirectories of the current working
directory.
`-fno-bounds-check'
By default, `gcj' generates code which checks the bounds of all
array indexing operations. With this option, these checks are
omitted. Note that this can result in unpredictable behavior if
the code in question actually does violate array bounds
constraints.
`-fjni'
With `gcj' there are two options for writing native methods: CNI
and JNI. By default `gcj' assumes you are using CNI. If you are
compiling a class with native methods, and these methods are
implemented using JNI, then you must use `-fjni'. This option
causes `gcj' to generate stubs which will invoke the underlying JNI
methods.
---------- Footnotes ----------
(1) The linker by default looks for a global function named `main'.
Since Java does not have global functions, and a collection of Java
classes may have more than one class with a `main' method, you need to
let the linker know which of those `main' methods it should invoke when
starting the application.