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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,7117a84edbedc116 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-04-14 16:05:27 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!newspeer.monmouth.com!newsfeed!wn13feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi_feed4!attbi.com!sccrnsc04.POSTED!not-for-mail From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: Re: Interfacing Ada with C References: <3e9b28f8$1_4@newsfeed> X-Newsreader: Tom's custom newsreader Message-ID: NNTP-Posting-Host: 12.234.13.56 X-Complaints-To: abuse@attbi.com X-Trace: sccrnsc04 1050361525 12.234.13.56 (Mon, 14 Apr 2003 23:05:25 GMT) NNTP-Posting-Date: Mon, 14 Apr 2003 23:05:25 GMT Organization: AT&T Broadband Date: Mon, 14 Apr 2003 23:05:25 GMT Xref: archiver1.google.com comp.lang.ada:36143 Date: 2003-04-14T23:05:25+00:00 List-Id: >The prototype for this function in C would normally be: > > void one(wide_string w); As you've noted, what C calls a wide_string is not the same thing as what Ada calls a Wide_String. If a C wide_string is a null terminated array of wchar_t, then you might try subtype variable_length_wide_string -- known length (size_t) so no bounds is Interfaces.C.wchar_array(Interfaces.C.size_t); procedure One(C_Name : in out variable_length_wide_string); pragma Export(C, One, "one"); ... procedure One(C_Name : in out variable_length_wide_string) is Name : Wide_String := Interfaces.C.To_Ada(C_Name); begin -- use/modify Name C_Name(0 .. Interfaces.C.Size_T(Name'length)) := Interfaces.C.To_C(Name); end One;