comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: c2ada bug report filed
Date: Thu, 31 Mar 2011 22:03:52 +0100
Date: 2011-03-31T22:03:52+01:00	[thread overview]
Message-ID: <m24o6jovd3.fsf@pushface.org> (raw)
In-Reply-To: 4d94c18b$0$4966$a8266bb1@postbox2.readnews.com

Per Sandberg <per.sandberg@bredband.net> writes:

> So i expect c2ada to be obsolete at least when GNAT GPL 2011 is
> released.

GNAT GPL 2010 certainly tries; I don't know how good it is.

Just tried on <tcl.h>; GPL 2010 is better than FSF 4.6.0, which didn't
understand
  #define TCL_MAJOR_VERSION 8
for example.

Both made a - to my eyes - strange choice about parameter passing:

   typedef struct Tcl_Interp {
       ...
   } Tcl_Interp;

translated as

   type Tcl_Interp is record
      ...
   end record;
   pragma Convention (C_Pass_By_Copy, Tcl_Interp);

Now, the C code that's being called most certainly doesn't expect
pass-by-copy; and the generated binding always says (eg)

   function Tcl_AppInit (arg1 : access Tcl_Interp) return int;

Wouldn't pragma Convention (C) have done?


For interest, the tcladashell equivalent (which, I believe, was
originally generated using c2ada, but has since been heavily
hand-amended) is

   type Tcl_Interp_Rec (<>) is private;
   type Tcl_Interp is access all Tcl_Interp_Rec;
   pragma Convention (C, Tcl_Interp);

   function Tcl_AppInit (interp : in Tcl_Interp) return C.int;

I shall have a think about this, the 'access' approach is certainly
neat. There's the question of whether null is allowed; if it is, and
customers are using Ada95, 'access' is ruled out.



  reply	other threads:[~2011-03-31 21:03 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-30  8:15 c2ada bug report filed Jerry
2011-03-30 14:15 ` Simon Wright
2011-03-30 20:03   ` Simon Wright
2011-04-02  4:45     ` Jerry
2011-04-04 17:27       ` Simon Wright
2011-04-04 23:46         ` Jerry
2011-03-31 18:01 ` Per Sandberg
2011-03-31 21:03   ` Simon Wright [this message]
2011-04-01  1:07     ` Randy Brukardt
2011-04-01  6:38       ` Simon Wright
replies disabled

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