comp.lang.ada
 help / color / mirror / Atom feed
From: Greg Baker <gbaker@walleroo.rp.csiro.au>
Subject: Re: Interfacing Ada Routines in C
Date: 1996/09/11
Date: 1996-09-11T00:00:00+00:00	[thread overview]
Message-ID: <85u3t5wr8q.fsf@walleroo.rp.CSIRO.AU> (raw)
In-Reply-To: 5156mj$gd0@rumors.ucr.edu


sto@cs.ucr.edu (Steven To) writes:
>   Does anyone know how I can interface an Ada procedure in my
> C program? 
> 
>   I've tried the following unsuccessfully:
>   
>   Compiled the ada procedure into an object file. Included
> the ada object file during the link, but the compiler isn't
> able to find the procedure referenced in my C program.
> 
>   BTW, I am using gcc and Sun Ada on a Solaris platform.

The Ada compiler does some slight name mangling (it includes the name
of the package in the link name). 
Without checking too carefully..

Ada:
 package Foo is
   procedure Bar;
 end Foo;

C:
  extern void foo__bar();
  
I derived the above information by compiling the foo package, and
running "nm foo.o | grep bar".  (Actually I did nothing of the sort,
I'm just going from memory).

Hope this helps.

-- 
Gregory D. Baker        gbaker@rp.csiro.au         CSIRO Radiophysics 
   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
   - predictions of the future - quantum computers - silly poetry  -
   - the "langue musicale universale" (Solresol)  revival project  - 
   - - - - - - - - http://www.rp.csiro.au/~gbaker  - - - - - - - - -
I am about to leave CSIRO. The above email address and URL may become
                    invalid in October.




  reply	other threads:[~1996-09-11  0:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-09-11  0:00 Interfacing Ada Routines in C Steven To
1996-09-11  0:00 ` Greg Baker [this message]
1996-09-11  0:00   ` Andy McNerney
1996-09-11  0:00 ` Robert Dewar
replies disabled

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