From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.6 X-Received: by 2002:ac8:7501:: with SMTP id u1mr17115059qtq.257.1642508335365; Tue, 18 Jan 2022 04:18:55 -0800 (PST) X-Received: by 2002:a25:8d0b:: with SMTP id n11mr34498411ybl.26.1642508335179; Tue, 18 Jan 2022 04:18:55 -0800 (PST) Path: eternal-september.org!reader02.eternal-september.org!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 18 Jan 2022 04:18:54 -0800 (PST) In-Reply-To: Injection-Info: google-groups.googlegroups.com; posting-host=80.194.57.154; posting-account=xS3LTwoAAAB3aeXopC8a-M58TGE8K6go NNTP-Posting-Host: 80.194.57.154 References: <09dcb07d-f7b8-432b-8338-840ff90faef1n@googlegroups.com> <55bae7e8-f5da-4cfc-b0f9-284bc900d89cn@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <13fa1a0d-eeed-4f44-a1ec-cace658fec0dn@googlegroups.com> Subject: Re: Odd Behaviour From: Mark Wilson Injection-Date: Tue, 18 Jan 2022 12:18:55 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader02.eternal-september.org comp.lang.ada:63390 List-Id: On Tuesday, January 18, 2022 at 12:08:16 PM UTC, Mark Wilson wrote: > On Tuesday, January 18, 2022 at 11:51:36 AM UTC, Mark Wilson wrote: > > On Tuesday, January 18, 2022 at 11:48:23 AM UTC, Jeffrey R.Carter wrote: > > > On 2022-01-18 12:05, Mark Wilson wrote: > > > > > > > > then an error is raised: 'warning: Valued_Procedure has no effect for convention Ada [enabled by default]' > > > The GNAT RM says of pragma Import_Valued_Procedure > > > > > > "Note that it is important to use this pragma in conjunction with a separate > > > pragma Import that specifies the desired convention, since otherwise the default > > > convention is Ada, which is almost certainly not what is required." > > > > > > What happens if you replace the import aspects with pragma Import? > > > -- > > > Jeff Carter > > > "Monsieur Arthur King, who has the brain of a duck, you know." > > > Monty Python & the Holy Grail > > > 09 > > Tried pragma Import, and even pragma Convention, so, for instance, > > procedure SQLAllocHandle > > (Result : out SQLRETURN; > > HandleType : in SQL_HANDLE_TYPE; > > InputHandle : in SQLHANDLE; > > OutputHandlePtr : in out SQLHANDLE) > > with > > Pre => (Handletype = SQL_Handle_Env); > > > > pragma Import (C, SQLAllocHandle, "SQLAllocHandle"); > > pragma Import_Valued_Procedure (SQLAllocHandle); > > > > Fails with the same warning. Take the 'pre' out and it works fine. > Even tried (which to be fair is a bit of a long shot), > procedure SQLAllocHandle > (Result : out SQLRETURN; > HandleType : in SQL_HANDLE_TYPE; > InputHandle : in SQLHANDLE; > OutputHandlePtr : in out SQLHANDLE); > -- with > -- Pre => (Handletype = SQL_Handle_Env); > > > pragma Import (C, SQLAllocHandle); > pragma Import_Valued_Procedure > (SQLAllocHandle, "SQLAllocHandle", > (SQLRETURN, SQL_HANDLE_TYPE, SQLHANDLE, SQLHANDLE), > (Reference, Value, Value, Reference)); > > Do you think I should file a bug report? Well, this works - but feels very naughty, function SQLAllocHandle (HandleType : in SQL_HANDLE_TYPE; InputHandle : in SQLHANDLE; OutputHandlePtr : in SQLHANDLE) return SQLRETURN; -- with -- Pre => (Handletype = SQL_Handle_Env); pragma Import (C, SQLAllocHandle); pragma Import_Function (SQLAllocHandle, "SQLAllocHandle", (SQL_HANDLE_TYPE, SQLHANDLE, SQLHANDLE), SQLRETURN, (Value, Value, Reference)); However, adding the precondition in results in ':(.text+0xb7): undefined reference to `sqlallochandle'''