From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.4 required=5.0 tests=AC_FROM_MANY_DOTS,BAYES_00 autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,97d5e85b59d5e24c X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!news.maxwell.syr.edu!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!cyclone1.gnilink.net!spamkiller2.gnilink.net!gnilink.net!trndny04.POSTED!0f19ed38!not-for-mail From: "Frank J. Lhota" Newsgroups: comp.lang.ada References: <3f27506b.0408200022.76094a5e@posting.google.com> Subject: Re: Ada equivalent to С++ header sentence. X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 Message-ID: Date: Fri, 20 Aug 2004 12:53:37 GMT NNTP-Posting-Host: 141.154.52.165 X-Complaints-To: abuse@verizon.net X-Trace: trndny04 1093006417 141.154.52.165 (Fri, 20 Aug 2004 08:53:37 EDT) NNTP-Posting-Date: Fri, 20 Aug 2004 08:53:37 EDT Xref: g2news1.google.com comp.lang.ada:2890 Date: 2004-08-20T12:53:37+00:00 List-Id: "Stephen Leake" 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.