From: "Frank J. Lhota" <NOSPAM.lhota.adarose@verizon.net>
Subject: Re: Ada equivalent to С++ header sentence.
Date: Fri, 20 Aug 2004 12:53:37 GMT
Date: 2004-08-20T12:53:37+00:00 [thread overview]
Message-ID: <lvmVc.9458$_w.3309@trndny04> (raw)
In-Reply-To: mailman.5.1093005464.28011.comp.lang.ada@ada-france.org
"Stephen Leake" <stephen_leake@acm.org> wrote in message
news:mailman.5.1093005464.28011.comp.lang.ada@ada-france.org...
> rhezusfactor@yahoo.com (Johnswort) writes:
>
> > I try to make a binding on an API, which has a header in C++ syntax.
> > As a complete moron in both C/C++, I want to grab the last straw
> > before giving up. So I ask for a hint: what would be the Ada
> > equivalent to the following:
> >
> > typedef BOOL (_stdcall T_hcConnect)(LPSTR lszCmd);
>
> This declares T_hcConnect to be a type designating a function that
> takes an LPSTR parameter and returns a BOOL result. The normal use in
> C for such a type is to designate a pointer to a function. So the
> equivalent in Ada is a function access type:
>
> type T_hcConnect is access function (lszCmd : in LPSTR) return BOOL;
>
> > Presumingly, LPSTR may come from Win32.
>
> Yes, it stands for "Long Pointer to String". You might be tempted to
> define it in Ada as:
>
> type LPSTR is access String; -- WRONG!
The Win32 packages that come with GNAT define LPSTR, along with conversion
routines to translate between Ada Strings, C.Interfaces strings and
Win32.LPSTR.
next prev parent reply other threads:[~2004-08-20 12:53 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-08-20 8:22 Ada equivalent to С++ header sentence Johnswort
2004-08-20 11:17 ` Jeff C,
2004-08-20 12:37 ` Stephen Leake
2004-08-20 12:53 ` Frank J. Lhota [this message]
2004-08-20 19:11 ` Johnswort
2004-08-24 3:32 ` Randy Brukardt
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox