comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pogner.demon.co.uk>
Subject: Re: Interfacing with C
Date: 1999/12/30
Date: 1999-12-30T00:00:00+00:00	[thread overview]
Message-ID: <x7vso0kig7b.fsf@pogner.demon.co.uk> (raw)
In-Reply-To: vhiln6cllz7.fsf@grotte.ifi.uio.no

Jan Kroken <jankr@nntp.ifi.uio.no> writes:

> void y (datum d)
> {
> 	printf("d.size=%d\n",d.dsize);
> }

> procedure y (d: datum);
> pragma Import(C,y,"y");

> What I don't understand here is that x works perfectly, while
> the datum in y gets fucket up. Why?

Normally when passing a struct in C you would pass a pointer to it:

  void y (datum *d)

I don't know what the standard says about passing structs, but it's
quite likely your Ada and C compilers are disagreeing.

See LRM B.3(69): An Ada parameter of a record type T, of any mode, is
passed as a t* argument to a C function, where t is the C struct
corresponding to the Ada type T.




       reply	other threads:[~1999-12-30  0:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <vhiln6cllz7.fsf@grotte.ifi.uio.no>
1999-12-30  0:00 ` Simon Wright [this message]
1999-12-31  0:00 ` Interfacing with C Jerry van Dijk
1999-12-31  0:00   ` Simon Wright
2009-05-18 11:29 cedric
2009-05-18 11:51 ` Maciej Sobczak
2009-05-18 11:58 ` Dmitry A. Kazakov
2009-05-18 12:11   ` Ludovic Brenta
2009-05-18 12:13     ` Ludovic Brenta
2009-06-01  8:24   ` David Thompson
     [not found] <7rtlav$bm7$1@nnrp1.deja.com>
     [not found] ` <37e2b0e7.0@news.pacifier.com>
1999-09-22  0:00   ` Richard D Riehle
1999-09-22  0:00     ` Ted Dennison
1999-09-22  0:00       ` David Botton
1999-09-23  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