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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,efac8f93bb1bec0a,start X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!v45g2000cwv.googlegroups.com!not-for-mail From: "Gerd" Newsgroups: comp.lang.ada Subject: Interfacing with C - pointer problem Date: 30 Jan 2007 06:23:37 -0800 Organization: http://groups.google.com Message-ID: <1170167017.790966.225850@v45g2000cwv.googlegroups.com> NNTP-Posting-Host: 62.159.113.204 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1170167024 767 127.0.0.1 (30 Jan 2007 14:23:44 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 30 Jan 2007 14:23:44 +0000 (UTC) User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322),gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: v45g2000cwv.googlegroups.com; posting-host=62.159.113.204; posting-account=_FaVAg0AAAAYUPoPAQYNRFF35JBHf9i7 Xref: g2news2.google.com comp.lang.ada:8706 Date: 2007-01-30T06:23:37-08:00 List-Id: I try to call some C code, so I wrote me a simple interface, but it does not what I expected. It looks like this: type LPSTR is access all String; procedure C_Func (x : LPSTR); -- expects an address (C-pointer, 32- bit) pragma Import (STDCALL, C_Func, "C_Func"); procedure Q is data : aliased String := "ABC" & Ascii.Nul; begin C_Func (data'unchecked_access); end Q; This does not work correct. What I found is, that data'Address is 32 bit and LPSTR is 64 bit. How to manage this? I tried a "pragma Convention (C, LPSTR);" but this gives a warning. So what would be the right way? Thanks in advance, Gerd