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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d3b4b121dd774c00,start X-Google-Attributes: gid103376,public From: dewar@cs.nyu.edu (Robert Dewar) Subject: Using GNAT with a non-Ada main program Date: 1996/03/28 Message-ID: #1/1 X-Deja-AN: 144766008 organization: Courant Institute of Mathematical Sciences newsgroups: comp.lang.ada Date: 1996-03-28T00:00:00+00:00 List-Id: This question was raised recently, and it is definitely true that the temporary documentation in gnatinfo.txt is inadequate. This is fully described in the SGI documentation, but of course many people do not have access to this (although as Tom pointed out, SGI does make this available on the Web). Anyway, here are the details. First compile all the Ada units. One way to do this is with a series of gnatmake calls: gnatmake -c unit gnatmake -c unit where unit are the Ada units to be accessed from the other language main program (or its subroutines). the -c says compile only, since we don't want gnatmake doing any binding or linking yet. now do the bind gnatbind -n unit1.ali unit2.ali unit3.ali .... The -n says no Ada main program, and in the general case, you want to mention multiple Ada unit names, since the other-language main program may reference multiple ada units. You only need to include the directly called units here, not the indirectly called ones, since the normal closure processing of the binder will get all those. The bind file created contains the adainit() routine as described in the RM. It is named for the first unit in the gnatbind list, so the final link looks like gnatbl -linkonly unit1.ali main.o x.o y.o where the o files are for the other-language main program and its routines. You may want to ue the -o switch to clearly provide a name for the resulting executable.