comp.lang.ada
 help / color / mirror / Atom feed
From: Martin Dowie <martin.dowie@btopenworld.com>
Subject: Re: Returning data from Ada to C
Date: Sun, 8 May 2005 09:41:16 +0000 (UTC)
Date: 2005-05-08T09:41:16+00:00	[thread overview]
Message-ID: <d5kmrs$sct$1@nwrdmz03.dmz.ncs.ea.ibs-infra.bt.com> (raw)
In-Reply-To: <1115503927.228956.100050@z14g2000cwz.googlegroups.com>

igor.kh@gmail.com wrote:
[snip]
> == hello.c =============================
> #include <stdio.h>
> 
> void adainit();
> void adafinal();
> void hello_world(int *i, int **a_ptr);
> 
> int main()
> {
> 	int i = 1;
> 	int *a_ptr;
> 
> 	printf ("Calling Ada...\n");
> 
> 	adainit();
> 	hello_world(&i, &a_ptr);
> 
> 	printf ("...done\n");
> 	printf ("Returned i = %d\n", i);
> 	for (i=0; i<3; i++)
> 		printf ("a_ptr[%d] = %d\n", i, a_ptr[i]);
> 
> 	adafinal();
> 
> 	return 0;
> }
> ========================================
> 
> What am I missing to make this work?

Don't you have to allocate some memory for this array before passing it 
around?...

Cheers

-- Martin



  parent reply	other threads:[~2005-05-08  9:41 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-03 23:49 Returning data from Ada to C igor.kh
2005-05-04  4:49 ` Jeffrey Carter
2005-05-04 13:45   ` Igor Khavkine
2005-05-04 13:58     ` Alex R. Mosteo
2005-05-06  3:36     ` Jeffrey Carter
2005-05-07 22:12       ` igor.kh
2005-05-08  2:07         ` Jeffrey Carter
2005-05-08 19:58           ` Jeffrey Carter
2005-05-08  9:41         ` Martin Dowie [this message]
2005-05-08 14:55           ` Ludovic Brenta
2005-05-08 14:58             ` Ludovic Brenta
2005-05-09 22:49               ` igor.kh
2005-05-10 12:48                 ` Ludovic Brenta
2005-05-16  4:35   ` Dave Thompson
2005-05-16  5:03     ` Jeffrey Carter
replies disabled

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