comp.lang.ada
 help / color / mirror / Atom feed
* Calling an ADA-95 function from a C program
@ 1998-09-01  0:00 Ken Kham
  1998-09-02  0:00 ` grave
  0 siblings, 1 reply; 3+ messages in thread
From: Ken Kham @ 1998-09-01  0:00 UTC (permalink / raw)


I am trying to call an ADA-95 function from a main C program.
Can anybody give a step by step explanation about how to do it?
including how to invoke gcc, gnatbind, gnatlink
Yes, I did look at the GNAT User guide on the section
"Binding for Non-Ada main programs"
and did not have any luck.

Basically what I want to do is:
in Main C program:
result := ada_function();

In an ADa packagge, I would have
function ada_function return integer;




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

* Re: Calling an ADA-95 function from a C program
  1998-09-01  0:00 Calling an ADA-95 function from a C program Ken Kham
@ 1998-09-02  0:00 ` grave
  1998-09-03  0:00   ` dewarr
  0 siblings, 1 reply; 3+ messages in thread
From: grave @ 1998-09-02  0:00 UTC (permalink / raw)
  To: Ken Kham

Ken Kham wrote:
> 
> 
> In an ADa packagge, I would have
> function ada_function return integer;

Did you add :
pragma Convention(C,ada_function);

After gcc -c my_ada_package.adb you link you C programme with
my_ada_package.o

I think this would function.




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

* Re: Calling an ADA-95 function from a C program
  1998-09-02  0:00 ` grave
@ 1998-09-03  0:00   ` dewarr
  0 siblings, 0 replies; 3+ messages in thread
From: dewarr @ 1998-09-03  0:00 UTC (permalink / raw)


In article <35ECF33D.62EC@ipnsun5.in2p3.fr>,
  grave <grave@ipnsun5.in2p3.fr> wrote:
> Ken Kham wrote:
> >
> >
> > In an ADa packagge, I would have
> > function ada_function return integer;
>
> Did you add :
> pragma Convention(C,ada_function);
>
> After gcc -c my_ada_package.adb you link you C programme with
> my_ada_package.o
>
> I think this would function.
>


No, this is wrong advice, clearly you want pragma Export here,
not pragma Convention.

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum




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

end of thread, other threads:[~1998-09-03  0:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-09-01  0:00 Calling an ADA-95 function from a C program Ken Kham
1998-09-02  0:00 ` grave
1998-09-03  0:00   ` dewarr

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