From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,5e3fa264114b41e3 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-01-20 22:49:03 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!canoe.uoregon.edu!arclight.uoregon.edu!wn4feed!worldnet.att.net!135.173.83.71!wnfilter1!worldnet-localpost!bgtnsc04-news.ops.worldnet.att.net.POSTED!not-for-mail Message-ID: <3C4BB9B2.6080409@worldnet.att.net> From: Jim Rogers User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:0.9.4) Gecko/20011128 Netscape6/6.2.1 X-Accept-Language: en-us MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Setting up a Java Callback to Ada References: <3C49BE2C.F114478D@earthlink.net> <2870b407.0201202208.23b3374f@posting.google.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Date: Mon, 21 Jan 2002 06:49:02 GMT NNTP-Posting-Host: 12.86.32.232 X-Complaints-To: abuse@worldnet.att.net X-Trace: bgtnsc04-news.ops.worldnet.att.net 1011595742 12.86.32.232 (Mon, 21 Jan 2002 06:49:02 GMT) NNTP-Posting-Date: Mon, 21 Jan 2002 06:49:02 GMT Organization: AT&T Worldnet Xref: archiver1.google.com comp.lang.ada:19129 Date: 2002-01-21T06:49:02+00:00 List-Id: 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