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=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE, MSGID_SHORT autolearn=no autolearn_force=no version=3.4.4 Xref: utzoo comp.lang.ada:4842 comp.lang.c:36175 Path: utzoo!dciem!array!mark From: mark@array.UUCP (Mark Culp) Newsgroups: comp.lang.ada,comp.lang.c Subject: Calling Ada routines from C programs. Message-ID: <1884@array.UUCP> Date: 15 Feb 91 18:14:48 GMT Organization: Array Systems Computing, Toronto, CANADA List-Id: We have a large application program developed in C that we would like to port to an underlying operating system (CAIS-A) which is written in Ada. Before we start on this attempt, we realize that our largest problem is going to be trying to call an Ada routine from our C program. I have attempted to call an Ada routine from a C sub-routine (of an Ada main procedure) using the Telesoft Ada compiler, but have had no success with the linker resolving the Ada's routine name. Here is my test Ada source program: with Text_IO; procedure Ada_Routine is begin Text_IO.Put_Line( "Ada Routine" ); end Ada_Routine; with Text_IO; with Ada_Routine; procedure Test_C_Interface is procedure C_Main_Routine; pragma Interface( C, C_Main_Routine ); begin Text_IO.Put_Line( "Begin" ); C_Main_Routine; Text_IO.Put_Line( "End" ); end Test_C_Interface; and here is my test C routine: #include void c_main_routine() { printf( "c_main_routine begin\n" ); ada_routine(); printf( "c_main_routine end\n" ); } I have tried variations on the "ada_routine()" call, but with no success. If you have attempted to do this, or know how to solve this problem, I would be grateful to here from you. Please email, I will summarize. Thanks. Mark. --------------------------------------------------------------------------- Mark N. Culp UUCP : {mnetor,utzoo}!lsuc!array!mark Array Systems Computing Inc. Internet: mark@array 401 Magnetic Drive, Unit 24 Phone : +1(416)736-0900 Fax: (416)736-4715 Downsview, Ont CANADA M3J 3H9 Home : +1(416)857-5290