comp.lang.ada
 help / color / mirror / Atom feed
* Calling Ada routines from C programs.
@ 1991-02-15 18:14 Mark Culp
  1991-02-18  0:23 ` Jim Showalter
  0 siblings, 1 reply; 5+ messages in thread
From: Mark Culp @ 1991-02-15 18:14 UTC (permalink / raw)



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 <stdio.h>

	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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~1991-02-19 19:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1991-02-15 18:14 Calling Ada routines from C programs Mark Culp
1991-02-18  0:23 ` Jim Showalter
1991-02-18 16:14   ` Karl Keyte
1991-02-19 15:05     ` David Emery
1991-02-19 19:37       ` Bruce Bauman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox