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,39ade949adb6bf4 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!postnews.google.com!r40g2000prf.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: StdCall and pragma Import_Function Date: Fri, 19 Aug 2011 10:26:01 -0700 (PDT) Organization: http://groups.google.com Message-ID: <090a4db0-d67c-4dfe-9d67-24b2edc3b392@r40g2000prf.googlegroups.com> References: <332032a4-0acf-459d-a743-e90e823ca5af@glegroupsg2000goo.googlegroups.com> <118ybwhr53151$.fjqabmpo2k23$.dlg@40tude.net> NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1313774762 31079 127.0.0.1 (19 Aug 2011 17:26:02 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 19 Aug 2011 17:26:02 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: r40g2000prf.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-Header-Order: ARLUEHNKC X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; WOW64; Trident/4.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30618; .NET4.0C),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:21654 Date: 2011-08-19T10:26:01-07:00 List-Id: On Aug 19, 9:51=A0am, "Dmitry A. Kazakov" wrote: > On Fri, 19 Aug 2011 09:24:33 -0700 (PDT), Felix Krause wrote: > > =A0 =A0pragma Import (StdCall, C_Function, "cFunc"); > > =A0 =A0pragma Import_Function (Internal =3D> C_Function, External =3D> = "cFunc", Mechanism =3D> (Param =3D> Value)); > > end P; > > Stdcall is the calling convention used by Windows API. =A0If you want to = call > a C function then most likely it rather should be C, i.e. > > =A0 =A0pragma Import (C, ...); The OP did say that the symbol name _cFunc@8 exists in the library, which indicates that using StdCall appears to be correct, just that GNAT is using the wrong size for the symbol. Offhand, this looks like a bug, but there may be some other legitimate reason why GNAT isn't getting the size right, and I'm not familiar enough with GNAT-specific pragmas to be of any more help. Out of curiosity, Felix, what happens if you add a 62-bit "filler" field to Bit_Vector, with 2..63 in the representation clause? Does that make things work? -- Adam