public inbox for java@gcc.gnu.org
 help / color / mirror / Atom feed
* -D ?
@ 2002-04-23  9:38 akos.szalay
  2002-04-23 14:39 ` Tom Tromey
  0 siblings, 1 reply; 4+ messages in thread
From: akos.szalay @ 2002-04-23  9:38 UTC (permalink / raw)
  To: java

What does the -D switch do ?
In the help it says "-D<macro>  Define a <macro> with string '1' as its
value", which is what I need, but when using it, I get an error "can't
specify '-D' without '--main'.
I try to compile together java and c code by using JNI (which works just
fine in the version from 17/12/2001 - in 3.0.4 it seems to be broken).
So what does the -D switch do, and what should I use instead to define a
macro ?
BTW, any estimation on the release of 3.1 ?

A'kos

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: -D ?
  2002-04-23  9:38 -D ? akos.szalay
@ 2002-04-23 14:39 ` Tom Tromey
  2002-04-23 16:59   ` Bryce McKinlay
  0 siblings, 1 reply; 4+ messages in thread
From: Tom Tromey @ 2002-04-23 14:39 UTC (permalink / raw)
  To: akos.szalay; +Cc: java

>>>>> "Akos" == akos szalay <akos.szalay@sophos.com> writes:

Akos> What does the -D switch do ?

From the manual:

    @item -D@var{name}[=@var{value}]
    This option can only be used with @code{--main}.  It defines a system
    property named @var{name} with value @var{value}.  If @var{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 @code{java.lang.System.getProperty} method.

The manual ought to be online somewhere, but to be honest I've never
checked.

Akos> In the help it says "-D<macro> Define a <macro> with string '1'
Akos> as its value", which is what I need, but when using it, I get an
Akos> error "can't specify '-D' without '--main'.

Yes.  You're reading the definition for C/C++, which is different.
Java doesn't have macros, so that definition of -D makes no sense for gcj.

Akos> I try to compile together java and c code by using JNI (which
Akos> works just fine in the version from 17/12/2001 - in 3.0.4 it
Akos> seems to be broken).  So what does the -D switch do, and what
Akos> should I use instead to define a macro ?

If you're compiling C code you should invoke `gcc'.  If you're
compiling C++ you should invoke `g++'.  Both of these will accept -D
in the way you expect.  gcj should only be used for compiling Java
code (either .java, .class, or resource files with --resource).

Akos> BTW, any estimation on the release of 3.1 ?

Soon, as soon as the critical bugs are fixed.  A prerelease came out
today.

Tom

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: -D ?
  2002-04-23 14:39 ` Tom Tromey
@ 2002-04-23 16:59   ` Bryce McKinlay
  2002-04-23 18:57     ` Tom Tromey
  0 siblings, 1 reply; 4+ messages in thread
From: Bryce McKinlay @ 2002-04-23 16:59 UTC (permalink / raw)
  To: tromey; +Cc: akos.szalay, java

Tom Tromey wrote:

>gcj should only be used for compiling Java
>code (either .java, .class, or resource files with --resource).
>

Why? It might not be a good idea to compile JNI code with gcj, but it 
can be very useful to use gcj to compile and link C/C++ code into a 
mixed Java/C++ application. But, it is unfortunate that the -D flag 
means different things to Java and C code.

regards

Bryce.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: -D ?
  2002-04-23 16:59   ` Bryce McKinlay
@ 2002-04-23 18:57     ` Tom Tromey
  0 siblings, 0 replies; 4+ messages in thread
From: Tom Tromey @ 2002-04-23 18:57 UTC (permalink / raw)
  To: Bryce McKinlay; +Cc: akos.szalay, java

>>>>> "Bryce" == Bryce McKinlay <bryce@waitaki.otago.ac.nz> writes:

>> gcj should only be used for compiling Java
>> code (either .java, .class, or resource files with --resource).

Bryce> Why? It might not be a good idea to compile JNI code with gcj,
Bryce> but it can be very useful to use gcj to compile and link C/C++
Bryce> code into a mixed Java/C++ application.  But, it is unfortunate
Bryce> that the -D flag means different things to Java and C code.

We already broke compatibility with -C.  Admittedly this isn't useful
in the situation you cite.

I think my bias here is that I'm not used to compiling things that
way.  I almost always compile to .o files first.

The problem to me is just one of supportability.  I don't think we've
ever advertised this feature.  We don't test it (more precisely, I
don't know of anybody testing it).  Supporting it means one more place
that we have to watch what happens in the C/C++ front ends to make
sure we don't have problems; this is hard because those front ends are
5x-10x as active as we are.

So in sum to me it seems like it isn't worth the effort.

Still, I don't feel all that strongly about it.  We could probably
devise a plan to rehabilitate -D (e.g., nearly-compatible change in
3.2, real change in 3.3).

Tom

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-04-24  1:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-23  9:38 -D ? akos.szalay
2002-04-23 14:39 ` Tom Tromey
2002-04-23 16:59   ` Bryce McKinlay
2002-04-23 18:57     ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).