comp.lang.ada
 help / color / mirror / Atom feed
From: David Thompson <dave.thompson2@verizon.net>
Subject: Re: Interfacing with C
Date: Mon, 01 Jun 2009 08:24:42 GMT
Date: 2009-06-01T08:24:42+00:00	[thread overview]
Message-ID: <q24725dakb70i5h821sg40s9j1ibstneer@4ax.com> (raw)
In-Reply-To: 6i3cwvzndx7y.1j38k2uakyqyp$.dlg@40tude.net

On Mon, 18 May 2009 13:58:35 +0200, "Dmitry A. Kazakov"
<mailbox@dmitry-kazakov.de> wrote:

> On Mon, 18 May 2009 04:29:44 -0700 (PDT), cedric wrote:

> > SPSSXD_API bool IsBackendReady();

>    with Interfaces.C;  use Interfaces.C;
>    ...
>    function IsBackendReady return Int; -- C does not have Boolean
>    pragma Import (stdcall, IsBackendReady, "IsBackendReady");
> 
C99 does, but that name is optional; _Bool always exists, but bool is
typedef'ed to it only if you #include <stdbool.h>. This was done to
preserve C90 (or earlier) code, where it is fairly common to typedef
bool to an integer or or enum type for documentation, even though it
doesn't change the actual semantics (and machine code). So it would be
necessary to determine which (or what) this code is using.

Though in practice, all integer types up to at least int/u-int are
often treated the same in the calling convention, so there's a fair
chance declaring it as Int=int will work even if it's really something
else including _Bool.




  parent reply	other threads:[~2009-06-01  8:24 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-18 11:29 Interfacing with C 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 [this message]
     [not found] <vhiln6cllz7.fsf@grotte.ifi.uio.no>
1999-12-30  0:00 ` Simon Wright
1999-12-31  0:00 ` Jerry van Dijk
1999-12-31  0:00   ` Simon Wright
     [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