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-22 10:36:47 PST Path: archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!newsfeed.icl.net!isdnet!newsfeed.online.be!hammer.uoregon.edu!skates!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: Setting up a Java Callback to Ada Date: 22 Jan 2002 13:35:38 -0500 Organization: NASA Goddard Space Flight Center Message-ID: References: <3C49BE2C.F114478D@earthlink.net> <2870b407.0201202208.23b3374f@posting.google.com> <3C4BB9B2.6080409@worldnet.att.net> <3C4C018B.82781040@earthlink.net> NNTP-Posting-Host: anarres.gsfc.nasa.gov Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: skates.gsfc.nasa.gov 1011724770 26980 128.183.220.71 (22 Jan 2002 18:39:30 GMT) X-Complaints-To: dscoggin@cne-odin.gsfc.nasa.gov NNTP-Posting-Date: 22 Jan 2002 18:39:30 GMT User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 Xref: archiver1.google.com comp.lang.ada:19191 Date: 2002-01-22T18:39:30+00:00 List-Id: "Marc A. Criley" 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