comp.lang.ada
 help / color / mirror / Atom feed
From: "Julian Morrison" <julian@extropy.demon.co.uk>
Subject: Questions: interfacing to C
Date: Tue, 02 Jan 2001 03:34:10 +0000
Date: 2001-01-02T03:34:10+00:00	[thread overview]
Message-ID: <978406443.13177.0.nnrp-09.9e98cc46@news.demon.co.uk> (raw)

Two questons, I can't see how the ARM resolves them.

First, I have in C:

   typedef struct foo {int a} FOO;
   typedef struct bar {FOO *b} BAR;

To shim to this from Ada, should I do:

   with Interfaces.C; use Interfaces.C;
   type FOO is record
      a : int;
   end record;
   pragma Convention (C, FOO);

   type FOO_Access is acess all FOO;
   pragma Convention (C, FOO_Access);

   type BAR is record
      b : FOO_Access;
   end record;
   pragma Convention(C, BAR);

Or will it not convert the access type - and i'd have to use
System.Address?

Next question, similarly I have in C:

   FOO* get_foo(void);

Can I shim to it as:

   function get_foo () return FOO_Access;
   pragma Import (C, get_foo);

or is it returning a System.Address?



             reply	other threads:[~2001-01-02  3:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-01-02  3:34 Julian Morrison [this message]
2001-01-02  4:19 ` Questions: interfacing to C James Rogers
2001-01-02  4:54   ` Robert Dewar
2001-01-02  5:15     ` Julian Morrison
2001-01-02  4:56   ` Julian Morrison
2001-01-02  4:32 ` tmoran
replies disabled

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