This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: C++ and GCJ
- From: Tom Tromey <tromey at redhat dot com>
- To: Szasz Pal <spacegcc at email dot ro>
- Cc: java at gcc dot gnu dot org
- Date: 05 Mar 2003 09:45:22 -0700
- Subject: Re: C++ and GCJ
- References: <200303051025.h25APfg20759@zerg.codec.ro>
- Reply-to: tromey at redhat dot com
>>>>> "Szasz" == Szasz Pal <spacegcc at email dot 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