comp.lang.ada
 help / color / mirror / Atom feed
From: Stephen Leake <stephen.a.leake.1@gsfc.nasa.gov>
Subject: Re: Setting up a Java Callback to Ada
Date: 22 Jan 2002 13:35:38 -0500
Date: 2002-01-22T18:39:30+00:00	[thread overview]
Message-ID: <ud702b5dx.fsf@gsfc.nasa.gov> (raw)
In-Reply-To: 3C4C018B.82781040@earthlink.net

"Marc A. Criley" <mcqada95@earthlink.net> writes:

> Jim Rogers wrote:
> > 
> > Note that the JNI model of software development ALWAYS starts with Java.
> > First you define your class containing remote methods. Then you create a
> > C header file from those methods using the javah tool. You implement the
> > corresponding C functions. You also implement the Java code to call the
> > remote methods. The C functions must handle all compatibility issues.
> > 
> > If you want Java to call an Ada subprogram you must build a C wrapper
> > that Java actually calls. That wrapper will handle all data
> > compatiblity issues and call the Ada subprogram. Trying to use JNI to
> > communicate between Java and Ada means programming in three languages.
> > 
> 
> Jim is correct here.  As an exercise a couple years ago I did in fact
> have Java call an Ada subprogram via JNI.  It worked, but I had to have
> the C wrapper, and also additional (native) C functions to call adainit
> and adafinal.

But you can export Ada fuctions with convention C, and call adainit
and adafinal from an Ada subprogram; just don't assume adainit has been
called yet in that subprogram!. That's sort of writing in Ada :).

-- 
-- Stephe



  reply	other threads:[~2002-01-22 18:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-01-18 18:11 Setting up a Java Callback to Ada Kevin Brugh
2002-01-19 19:38 ` Marc A. Criley
2002-01-21  6:08   ` Kevin Brugh
2002-01-21  6:49     ` Jim Rogers
2002-01-21  9:54       ` Hyman Rosen
2002-01-21 22:40         ` David Kirk
2002-01-21 12:50       ` Marc A. Criley
2002-01-22 18:35         ` Stephen Leake [this message]
2002-01-23 21:04           ` richtmp
2002-01-25 12:53             ` Marc A. Criley
replies disabled

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