C++ and GCJ

Tom Tromey tromey@redhat.com
Wed Mar 5 16:53:00 GMT 2003


>>>>> "Szasz" == Szasz Pal <spacegcc@email.ro> writes:

Szasz> int main()
Szasz> {
Szasz>     printf("IN main!\n");
Szasz>     int a=8;
Szasz>     printf("a=%d\n",a);
Szasz>     test tmp;
Szasz>     int b=tmp->sqr(a);

Szasz> Well, first of all, this is a good way to combine C++ and Java ?

Yes.  However, the gcj runtime needs a certain amount of
initialization.  You can't just start making Java calls -- you'll get
crashes, as you saw.  Read about the CNI Invocation API in the gcj
docs.  (This is in the 3.3 docs anyway; probably not in 3.2.)

A simpler thing to do is to make `main' be a Java method.
Then when you link with `--main=...', the initialization will happen
for you.

Szasz> I need the both, because this way I can develop with rhide,
Szasz> and I can use it's the debugging facility.

Indeed.

Tom



More information about the Java mailing list