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-Thread: 103376,efac8f93bb1bec0a X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail NNTP-Posting-Date: Tue, 30 Jan 2007 15:10:53 -0600 From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: Re: Interfacing with C - pointer problem References: <1170167017.790966.225850@v45g2000cwv.googlegroups.com> X-Newsreader: Tom's custom newsreader Message-ID: Date: Tue, 30 Jan 2007 15:10:53 -0600 NNTP-Posting-Host: 67.164.83.70 X-Trace: sv3-ymdQnjrOwWJpPgo+r4P14DjwazW5nSm2JYHicyoLamyyKF3d8t9rRy3soS1unSvV4uXOwshbY6E+YV8!AcGh+5kPXlVnK3seEs4J9fznQzPclo/cQdWprksWB2ECaB/VLT2/IUXs/Fut/g2s/MOIIAmDkwSW!+5A/IUSzP7r76g== X-Complaints-To: abuse@comcast.net X-DMCA-Complaints-To: dmca@comcast.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.32 Xref: g2news2.google.com comp.lang.ada:8745 Date: 2007-01-30T15:10:53-06:00 List-Id: > type LPSTR is access all String; > > This does not work correct. What I found is, that data'Address is 32 > bit and LPSTR is 64 bit. Because LPSTR points to a dynamic size string and thus needs to carry along bounds information. A C LPSTR does not point to a dynamic string, but instead points to a single character - the first in the string. So the match is type LPSTR is access Interfaces.C.Char; procedure C_Func (x : LPSTR); -- expects an address (C-pointer, 32-bit) and then data : Interfaces.C.char_array := Interfaces.C.To_C("ABC"); and C_Func (data(data'first)'unchecked_access);