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,52882f38318f3520 X-Google-Attributes: gid103376,public From: newmans@ncr.disa.mil Subject: Linking an ADA routine to a program written in C Date: 1996/09/18 Message-ID: <51p2vu$enf@lal.interserv.com>#1/1 X-Deja-AN: 181480535 organization: InterServ News Service newsgroups: comp.lang.ada Date: 1996-09-18T00:00:00+00:00 List-Id: I desperately need an explanation of how to link a routine written and compiled in ADA into a program written in C. For example, I built an ada test procedure hello.a and compiled it using the ada compiler. The object file produced was called hello01. This program uses TEST_IO package to do the output. Since the object module hello01 is ELF-32 bit I linked it in with my C objects using gcc. But of course, I get undefined symbols because I have no idea how to tell gcc about the TEST_IO package. Does anyone know how this can be done. Also, some people have mentioned that I may have to use a PRAGMA in my C code to tell the compiler that the routine I am calling i.e. "hello" is not a C subroutine. C passes arguments from right to left. I believe ADA probably passes them like PASCAL from left to right. In C you can declare a routine to be type pascal to change the calling sequence to match PASCAL's. If anyone has any experience calling ADA routines from C please contact me ASAP. Thank you!