comp.lang.ada
 help / color / mirror / Atom feed
From: Geoff Bull <gbull@acenet.com.au>
Subject: Re: What is the best Xwindow, window98 program to use frames withada?
Date: 1999/12/12
Date: 1999-12-12T00:00:00+00:00	[thread overview]
Message-ID: <38524EC0.3283808A@acenet.com.au> (raw)
In-Reply-To: 82p3sp$cds$1@lure.pipex.net

I assume you are talking amount interfacing native Ada to Java
on a JVM.

Paul Hussein wrote:
> Write your GUI in Java and then use an automated
> binding generator like JGNAT ADAJNI to generate a binding.
                         ^^^^^

But JGNAT is a compiler for Ada targetting JVM.
It happens to come with a binding generator, but
this (presumably, I haven't seen it) will only produce
bindings suitable for compiling with JGNAT.
Apart from the obviously difficulties that it's bindiings don't
talk JNI, a lot of Java classes are only useful once you inherit
from them. Thus you need to write Java code to do this inheritance
and the call native methods. However, you'll find that most such
methods are trivial and since you are writting some Java, you may
as well write a bit more (easier than mucking around with the
binding generator). Soon you find you whole GUI is written
in Java. This is not necessarily a bad thing, I happen to think
that is one of the few things for which  Java is particularly good.
I have worked out a way to avoid writing any Java code (just have
the native code generate the required Java byte code) but I haven't
got around to implementing this yet.

Also, if you have JGNAT, there is absolutely no reason to write
your GUI in Java (apart from your boss telling you to).

AdaJNI doesn't interest me because, among other things,
it costs money, it's not open source, it doesn't have JDK 1.2
support (at least, I don't think so), and the way it handles events
is not (IMO) the best way to do it (but they have a product
and I don't!).

I have been working on a Javadoc based binding generator,
and it seems to be that the requirements for a native binding
working through JNI with no Java specific compiler support
are a bit different to the requirements for JGNAT.
Nevertheless, when JGNAT becomes public I might see if I can't
bend it to generate bindings that work with JNI.
(My Javadoc generator works, in a limited sense, but Javadoc
(Windows?) really chokes on swing on a PC with only 64MB).

The real problem with using thin JNI is that it is unsafe.
I.e. It is easy to pass a wrong argument and this, apart from
being difficult to debug, usually blows up the JVM (that is better
than blundering on).

Of course, it is not hard to hand build type safe bindings on
top of JNI, so long as you don't need too many and you don't
need iheritance.The next version of Cafe1815 has some generic
packages (built to support my "grinder" binding generator) that
make this a bit (a lot!) more palatable.


Cheers
Geoff




  reply	other threads:[~1999-12-12  0:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-12-08  0:00 What is the best Xwindow, window98 program to use frames with ada? Carlisle, Martin
1999-12-09  0:00 ` What is the best Xwindow, window98 program to use frames withada? Geoff Bull
1999-12-09  0:00   ` Paul Hussein
1999-12-12  0:00     ` Geoff Bull [this message]
1999-12-11  0:00       ` Ed Falis
1999-12-12  0:00         ` Paul Hussein
1999-12-13  0:00           ` Geoff Bull
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox