comp.lang.ada
 help / color / mirror / Atom feed
From: Jim Rogers <jimmaureenrogers@worldnet.att.net>
Subject: Re: Setting up a Java Callback to Ada
Date: Mon, 21 Jan 2002 06:49:02 GMT
Date: 2002-01-21T06:49:02+00:00	[thread overview]
Message-ID: <3C4BB9B2.6080409@worldnet.att.net> (raw)
In-Reply-To: 2870b407.0201202208.23b3374f@posting.google.com

Kevin Brugh wrote:

> Yes, a JNI.  I have Aonix 95 that uses JNI to interface with Java
> code.  But, since Ada doesn't have Objects/Method like Java.  Ada
> cannot handle Java interfaces, which Weblogic and many other Java
> Classes use a lot of.  I figured if I could pass the access of the
> procedure to Java and it would save it, then when my method was
> invoked/notified I could use that call back procedure.  It would be
> nice if Java could call a Ada procedure that would call my callback
> procedure directly. I have looked at using a C/C++ wrapper for Java,
> but I would like something more simpler and direct.
> 

The real difficulty is on the Java side. Sun claims that JNI should be
able to work with a wide variety of languages. Currently JNI works only
with C. This means that your Ada dlls or shared libraries must look like
C. It also means that you are responsible for handling any and all
data compatibility issues between Ada and Java. Part of the JNI model
is that Java has no knowledge of other programming languages. All other
languages must support Java data types for JNI to work.

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 Rogers
Colorado Springs, Colorado USA




  reply	other threads:[~2002-01-21  6:49 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 [this message]
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
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