This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: C++ and GCJ


>>>>> "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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]