comp.lang.ada
 help / color / mirror / Atom feed
* Questions: interfacing to C
@ 2001-01-02  3:34 Julian Morrison
  2001-01-02  4:19 ` James Rogers
  2001-01-02  4:32 ` tmoran
  0 siblings, 2 replies; 6+ messages in thread
From: Julian Morrison @ 2001-01-02  3:34 UTC (permalink / 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?



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

end of thread, other threads:[~2001-01-02  5:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-01-02  3:34 Questions: interfacing to C Julian Morrison
2001-01-02  4:19 ` 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

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