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,47a4be9898f849f0 X-Google-Attributes: gid103376,public From: "David C. Hoos, Sr." Subject: Re: Linking FORTRAN77 to Ada83 Date: 1999/06/09 Message-ID: #1/1 X-Deja-AN: 487755759 Content-Transfer-Encoding: 7bit References: <375ECA88.CF7CFF7E@sll.northrop.com> Content-Type: text/plain; charset="iso-8859-1" MIME-Version: 1.0 Newsgroups: comp.lang.ada X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 Date: 1999-06-09T00:00:00+00:00 List-Id: Guy Calinsky wrote in message news:375ECA88.CF7CFF7E@sll.northrop.com... > I have a subroutine written in FORTRAN that I need to link with my Ada > 83 code, but I am getting an Undefined Symbol error on that subroutine. > I followed the pragma example in the LRM (13.9). You didn't say what compiler and platform your'e using, so some guessing will need to be done. I would guess two things, viz.: 1. You probably need pragma Interface_Name (root, "root"); to associate the case insensitive Ada name you declared in the pragma Interface with the symbol produced by your Fortran compiler, for which the linker will seek to resolve. This pragma would follow the pragma Interface. Check your compiler's documentation, Appendix F. 2. You need to see whether the symbol produced by your Fortran compiler is indeed "root" -- it might be "_root", or some other. An object dump program can help you do this. The name in the second parameter of the pragma Interface_Name needs to match the symbol name in order for the linker to find the correct procedure to call. > Here is a small app I created to test the concept: > ---------------------- > > with Text_io; use Text_io; > with Long_Float_io; use Long_Float_io; > > procedure Ada_Main is > > procedure root(A : Long_Float; B : Long_Float; C : Long_Float; Result > : out Long_Float); > pragma Interface(Fortran, root); > > result : Long_Float; > > begin > > root(1.0, 2.0, 1.0, result); > put("result = "); put(result); new_line; > > end Ada_Main; > ---------------------- > > My FORTRAN subroutine : > subroutine root(a, b, c, x) > implicit none > real a, b, c, x > x = SQRT(b**2 - 4.0 * a * c) / (2.0 * a) > return > end > ---------------------- > > My Make script : > f77 -Xlist -g -C root.for > ada ada_main.a > a.ld -o ada_fortran_test ada_main root.o > ---------------------- > > Everything compiles ok and root.o does exist, yet I get this result : > Undefined first referenced > symbol in file > root > /home/calinsky/Fortran_Ada_Test/.objects/ada_main01 > ld: fatal: Symbol referencing errors. No output written to > ada_fortran_test > > > Any thoughts or ideas? > Thanks, > Guy >