Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Testing can show the presense of bugs, but not their absence. -- Dijkstra


devel / comp.lang.ada / Odd Behaviour

SubjectAuthor
* Odd BehaviourMark Wilson
+* Re: Odd BehaviourMarius Amado-Alves
|`* Re: Odd BehaviourMark Wilson
| `- Re: Odd BehaviourMark Wilson
+* Re: Odd BehaviourJeffrey R.Carter
|`- Re: Odd BehaviourMark Wilson
`* Re: Odd BehaviourJeffrey R.Carter
 `* Re: Odd BehaviourMark Wilson
  `* Re: Odd BehaviourMark Wilson
   +* Re: Odd BehaviourMark Wilson
   |`* Re: Odd BehaviourMark Wilson
   | `- Re: Odd BehaviourMark Wilson
   `* Re: Odd BehaviourJeffrey R.Carter
    `- Re: Odd BehaviourMark Wilson

1
Odd Behaviour

<09dcb07d-f7b8-432b-8338-840ff90faef1n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=6542&group=comp.lang.ada#6542

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:ac8:4e53:: with SMTP id e19mr13982928qtw.345.1642503954485;
Tue, 18 Jan 2022 03:05:54 -0800 (PST)
X-Received: by 2002:a25:8d0b:: with SMTP id n11mr34133317ybl.26.1642503954282;
Tue, 18 Jan 2022 03:05:54 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.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 03:05:53 -0800 (PST)
Injection-Info: google-groups.googlegroups.com; posting-host=80.194.57.154; posting-account=xS3LTwoAAAB3aeXopC8a-M58TGE8K6go
NNTP-Posting-Host: 80.194.57.154
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <09dcb07d-f7b8-432b-8338-840ff90faef1n@googlegroups.com>
Subject: Odd Behaviour
From: markwil...@wilsonnet.technology (Mark Wilson)
Injection-Date: Tue, 18 Jan 2022 11:05:54 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 44
 by: Mark Wilson - Tue, 18 Jan 2022 11:05 UTC

If I use,

procedure SQLAllocHandle
(Result : out SQLRETURN;
HandleType : in SQL_HANDLE_TYPE;
InputHandle : in SQLHANDLE;
OutputHandlePtr : in out SQLHANDLE)
with
Import => True,
Convention => C,
External_Name => "SQLAllocHandle";
pragma Import_Valued_Procedure (SQLAllocHandle);

then everything works as expected. However, if I add the following Pre and Post conditions (it's definitely not the Global or Depends)

procedure SQLAllocHandle
(Result : out SQLRETURN;
HandleType : in SQL_HANDLE_TYPE;
InputHandle : in SQLHANDLE;
OutputHandlePtr : in out SQLHANDLE)
with
Import => True,
Convention => C,
External_Name => "SQLAllocHandle",
Global => null,
Depends => ((Result, OutputHandlePtr) =>
(HandleType, InputHandle, OutputHandlePtr)),
Pre => (if HandleType = SQL_HANDLE_ENV then
InputHandle = SQL_NULL_HANDLE
else
InputHandle /= SQL_NULL_HANDLE),
Post => (if SQL_OK (Result) then
OutputHandlePtr /= SQL_NULL_HANDLE
else
OutputHandlePtr = SQL_NULL_HANDLE);

pragma Import_Valued_Procedure (SQLAllocHandle);

then an error is raised: 'warning: Valued_Procedure has no effect for convention Ada [enabled by default]' If I ignore the error, using

pragma Warnings (Off, "*convention Ada*");

then it doesn't work at all, as one would expect, raising storage_error.

So, is it the case that, even if you suppress all checks, using an 'if' in a pre or post condition forces a import function stub to only be convention Ada?

Re: Odd Behaviour

<044fecdb-18ad-40e8-a776-8da01573434dn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=6543&group=comp.lang.ada#6543

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a05:6214:4105:: with SMTP id kc5mr14603371qvb.24.1642504616843;
Tue, 18 Jan 2022 03:16:56 -0800 (PST)
X-Received: by 2002:a25:b19d:: with SMTP id h29mr34545886ybj.152.1642504616711;
Tue, 18 Jan 2022 03:16:56 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!1.us.feeder.erje.net!2.us.feeder.erje.net!feeder.erje.net!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 03:16:56 -0800 (PST)
In-Reply-To: <09dcb07d-f7b8-432b-8338-840ff90faef1n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=94.60.27.164; posting-account=3cDqWgoAAAAZXc8D3pDqwa77IryJ2nnY
NNTP-Posting-Host: 94.60.27.164
References: <09dcb07d-f7b8-432b-8338-840ff90faef1n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <044fecdb-18ad-40e8-a776-8da01573434dn@googlegroups.com>
Subject: Re: Odd Behaviour
From: amado.al...@gmail.com (Marius Amado-Alves)
Injection-Date: Tue, 18 Jan 2022 11:16:56 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 2
 by: Marius Amado-Alves - Tue, 18 Jan 2022 11:16 UTC

To find the culprit I would:
Test Pre vs. Post (Pre only vs. Post only).
Unit test function SQL_OK for storage error just in case.

Re: Odd Behaviour

<7dd99faa-6bb3-4224-baee-6795a67a6969n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=6544&group=comp.lang.ada#6544

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:ac8:7b54:: with SMTP id m20mr16074894qtu.380.1642504881507;
Tue, 18 Jan 2022 03:21:21 -0800 (PST)
X-Received: by 2002:a05:6902:150d:: with SMTP id q13mr8195427ybu.355.1642504881384;
Tue, 18 Jan 2022 03:21:21 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!1.us.feeder.erje.net!feeder.erje.net!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 03:21:21 -0800 (PST)
In-Reply-To: <044fecdb-18ad-40e8-a776-8da01573434dn@googlegroups.com>
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> <044fecdb-18ad-40e8-a776-8da01573434dn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <7dd99faa-6bb3-4224-baee-6795a67a6969n@googlegroups.com>
Subject: Re: Odd Behaviour
From: markwil...@wilsonnet.technology (Mark Wilson)
Injection-Date: Tue, 18 Jan 2022 11:21:21 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 13
 by: Mark Wilson - Tue, 18 Jan 2022 11:21 UTC

On Tuesday, January 18, 2022 at 11:16:57 AM UTC, amado...@gmail.com wrote:
> To find the culprit I would:
> Test Pre vs. Post (Pre only vs. Post only).
> Unit test function SQL_OK for storage error just in case.

It's not SQL_OK,

function SQL_OK
(rc : in SQLRETURN)
return Boolean
is
(rc = SQL_SUCCESS or else rc = SQL_SUCCESS_WITH_INFO);

And it fails with either Pre or Post, sadly - the only common problem seems to be the 'if'

Re: Odd Behaviour

<6b60d6a6-f691-45ae-8c4f-8be5ef9fe086n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=6545&group=comp.lang.ada#6545

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a05:6214:509e:: with SMTP id kk30mr21518162qvb.61.1642505097964; Tue, 18 Jan 2022 03:24:57 -0800 (PST)
X-Received: by 2002:a25:e64d:: with SMTP id d74mr3179291ybh.323.1642505097836; Tue, 18 Jan 2022 03:24:57 -0800 (PST)
Path: i2pn2.org!i2pn.org!aioe.org!news.uzoreto.com!tr3.eu1.usenetexpress.com!feeder.usenetexpress.com!tr3.iad1.usenetexpress.com!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 03:24:57 -0800 (PST)
In-Reply-To: <7dd99faa-6bb3-4224-baee-6795a67a6969n@googlegroups.com>
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> <044fecdb-18ad-40e8-a776-8da01573434dn@googlegroups.com> <7dd99faa-6bb3-4224-baee-6795a67a6969n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <6b60d6a6-f691-45ae-8c4f-8be5ef9fe086n@googlegroups.com>
Subject: Re: Odd Behaviour
From: markwil...@wilsonnet.technology (Mark Wilson)
Injection-Date: Tue, 18 Jan 2022 11:24:57 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 16
 by: Mark Wilson - Tue, 18 Jan 2022 11:24 UTC

On Tuesday, January 18, 2022 at 11:21:22 AM UTC, Mark Wilson wrote:
> On Tuesday, January 18, 2022 at 11:16:57 AM UTC, amado...@gmail.com wrote:
> > To find the culprit I would:
> > Test Pre vs. Post (Pre only vs. Post only).
> > Unit test function SQL_OK for storage error just in case.
> It's not SQL_OK,
>
> function SQL_OK
> (rc : in SQLRETURN)
> return Boolean
> is
> (rc = SQL_SUCCESS or else rc = SQL_SUCCESS_WITH_INFO);
>
> And it fails with either Pre or Post, sadly - the only common factor seems to be the 'if'

Does this look like a compiler bug? Or, hitherto, undocumented behaviour with Pre and Post conditions?

Re: Odd Behaviour

<ss6896$hh6$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=6546&group=comp.lang.ada#6546

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: spam.jrc...@spam.acm.org.not (Jeffrey R.Carter)
Newsgroups: comp.lang.ada
Subject: Re: Odd Behaviour
Date: Tue, 18 Jan 2022 12:28:38 +0100
Organization: A noiseless patient Spider
Lines: 27
Message-ID: <ss6896$hh6$1@dont-email.me>
References: <09dcb07d-f7b8-432b-8338-840ff90faef1n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 18 Jan 2022 11:28:38 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="4de166002d9673ed6313a248996ba33e";
logging-data="17958"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19+R0BkTe/8yN+h/tsN1fYmb8x+NKpCZXM="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.3.1
Cancel-Lock: sha1:fTsFSfCOxIfNbLSxjieDD5RdE8Q=
In-Reply-To: <09dcb07d-f7b8-432b-8338-840ff90faef1n@googlegroups.com>
Content-Language: en-US
 by: Jeffrey R.Carter - Tue, 18 Jan 2022 11:28 UTC

On 2022-01-18 12:05, Mark Wilson wrote:
>
> Pre => (if HandleType = SQL_HANDLE_ENV then
> InputHandle = SQL_NULL_HANDLE
> else
> InputHandle /= SQL_NULL_HANDLE),
> Post => (if SQL_OK (Result) then
> OutputHandlePtr /= SQL_NULL_HANDLE
> else
> OutputHandlePtr = SQL_NULL_HANDLE);

What happens with

Pre => (Handletype = SQL_Handle_Env) = (Inputhandle = SQL_Null_Handle)

and

Post => SQL_OK (Result) = (Outputhandleptr /= SQL_Null_Handle)

which seem to be equivalent?

--
Jeff Carter
"Monsieur Arthur King, who has the brain of a duck, you know."
Monty Python & the Holy Grail
09

Re: Odd Behaviour

<cfd509de-2cda-4b7c-a217-ed50f6891c32n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=6547&group=comp.lang.ada#6547

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a37:44cd:: with SMTP id r196mr17367765qka.90.1642505759275;
Tue, 18 Jan 2022 03:35:59 -0800 (PST)
X-Received: by 2002:a25:6d06:: with SMTP id i6mr31477116ybc.216.1642505759169;
Tue, 18 Jan 2022 03:35:59 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!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 03:35:58 -0800 (PST)
In-Reply-To: <ss6896$hh6$1@dont-email.me>
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> <ss6896$hh6$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <cfd509de-2cda-4b7c-a217-ed50f6891c32n@googlegroups.com>
Subject: Re: Odd Behaviour
From: markwil...@wilsonnet.technology (Mark Wilson)
Injection-Date: Tue, 18 Jan 2022 11:35:59 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 37
 by: Mark Wilson - Tue, 18 Jan 2022 11:35 UTC

On Tuesday, January 18, 2022 at 11:28:41 AM UTC, Jeffrey R.Carter wrote:
> On 2022-01-18 12:05, Mark Wilson wrote:
> >
> > Pre => (if HandleType = SQL_HANDLE_ENV then
> > InputHandle = SQL_NULL_HANDLE
> > else
> > InputHandle /= SQL_NULL_HANDLE),
> > Post => (if SQL_OK (Result) then
> > OutputHandlePtr /= SQL_NULL_HANDLE
> > else
> > OutputHandlePtr = SQL_NULL_HANDLE);
> What happens with
>
> Pre => (Handletype = SQL_Handle_Env) = (Inputhandle = SQL_Null_Handle)
>
> and
>
> Post => SQL_OK (Result) = (Outputhandleptr /= SQL_Null_Handle)
>
> which seem to be equivalent?
>
> --
> Jeff Carter
> "Monsieur Arthur King, who has the brain of a duck, you know."
> Monty Python & the Holy Grail
> 09

It fails (same warning) with only,

Pre => (Handletype = SQL_Handle_Env);

Guess you can't have Pre or Post with Valued_Procedures. A warning is suppressed that mentions that these are supported, yet,

pragma Warnings (Off, "*not yet supported*");

But that warning is only issued on Spark Analysis, not on the main Ada compile.

Hrmph. No problem to abstract away - so not a show killer - ie hide an Ada stub in the body, and leave the Spark annotations in the spec so we won't need to use Valued_Procedures. Functions in Spark can't have in out parameters, of course.

Re: Odd Behaviour

<ss69e5$p17$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=6548&group=comp.lang.ada#6548

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: spam.jrc...@spam.acm.org.not (Jeffrey R.Carter)
Newsgroups: comp.lang.ada
Subject: Re: Odd Behaviour
Date: Tue, 18 Jan 2022 12:48:21 +0100
Organization: A noiseless patient Spider
Lines: 18
Message-ID: <ss69e5$p17$1@dont-email.me>
References: <09dcb07d-f7b8-432b-8338-840ff90faef1n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 18 Jan 2022 11:48:21 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="4de166002d9673ed6313a248996ba33e";
logging-data="25639"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18iE5VuHNGvAQ+xzkrnfa+XO9cqTigjsMk="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.3.1
Cancel-Lock: sha1:NB4L7iW5ijZUYhQhwHFi9lT6rhk=
In-Reply-To: <09dcb07d-f7b8-432b-8338-840ff90faef1n@googlegroups.com>
Content-Language: en-US
 by: Jeffrey R.Carter - Tue, 18 Jan 2022 11:48 UTC

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

Re: Odd Behaviour

<55bae7e8-f5da-4cfc-b0f9-284bc900d89cn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=6549&group=comp.lang.ada#6549

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a05:6214:5096:: with SMTP id kk22mr22180934qvb.67.1642506695608;
Tue, 18 Jan 2022 03:51:35 -0800 (PST)
X-Received: by 2002:a25:b9d2:: with SMTP id y18mr33594463ybj.615.1642506695452;
Tue, 18 Jan 2022 03:51:35 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!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 03:51:35 -0800 (PST)
In-Reply-To: <ss69e5$p17$1@dont-email.me>
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> <ss69e5$p17$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <55bae7e8-f5da-4cfc-b0f9-284bc900d89cn@googlegroups.com>
Subject: Re: Odd Behaviour
From: markwil...@wilsonnet.technology (Mark Wilson)
Injection-Date: Tue, 18 Jan 2022 11:51:35 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 30
 by: Mark Wilson - Tue, 18 Jan 2022 11:51 UTC

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.

Re: Odd Behaviour

<e6a624b6-e754-4ee5-ad7b-c82f7ef1accan@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=6550&group=comp.lang.ada#6550

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a05:6214:d85:: with SMTP id e5mr21154970qve.74.1642507694861;
Tue, 18 Jan 2022 04:08:14 -0800 (PST)
X-Received: by 2002:a25:6d06:: with SMTP id i6mr31626239ybc.216.1642507694668;
Tue, 18 Jan 2022 04:08:14 -0800 (PST)
Path: i2pn2.org!i2pn.org!paganini.bofh.team!news.freedyn.de!newsreader4.netcologne.de!news.netcologne.de!peer02.ams1!peer.ams1.xlned.com!news.xlned.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.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:08:14 -0800 (PST)
In-Reply-To: <55bae7e8-f5da-4cfc-b0f9-284bc900d89cn@googlegroups.com>
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>
<ss69e5$p17$1@dont-email.me> <55bae7e8-f5da-4cfc-b0f9-284bc900d89cn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <e6a624b6-e754-4ee5-ad7b-c82f7ef1accan@googlegroups.com>
Subject: Re: Odd Behaviour
From: markwil...@wilsonnet.technology (Mark Wilson)
Injection-Date: Tue, 18 Jan 2022 12:08:14 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 3125
 by: Mark Wilson - Tue, 18 Jan 2022 12:08 UTC

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?

Re: Odd Behaviour

<13fa1a0d-eeed-4f44-a1ec-cace658fec0dn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=6551&group=comp.lang.ada#6551

  copy link   Newsgroups: comp.lang.ada
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: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!3.eu.feeder.erje.net!2.us.feeder.erje.net!feeder.erje.net!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: <e6a624b6-e754-4ee5-ad7b-c82f7ef1accan@googlegroups.com>
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>
<ss69e5$p17$1@dont-email.me> <55bae7e8-f5da-4cfc-b0f9-284bc900d89cn@googlegroups.com>
<e6a624b6-e754-4ee5-ad7b-c82f7ef1accan@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: markwil...@wilsonnet.technology (Mark Wilson)
Injection-Date: Tue, 18 Jan 2022 12:18:55 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 65
 by: Mark Wilson - Tue, 18 Jan 2022 12:18 UTC

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 '<artificial>:(.text+0xb7): undefined reference to `sqlallochandle'''

Re: Odd Behaviour

<ss6bjn$7dl$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=6552&group=comp.lang.ada#6552

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: spam.jrc...@spam.acm.org.not (Jeffrey R.Carter)
Newsgroups: comp.lang.ada
Subject: Re: Odd Behaviour
Date: Tue, 18 Jan 2022 13:25:27 +0100
Organization: A noiseless patient Spider
Lines: 34
Message-ID: <ss6bjn$7dl$1@dont-email.me>
References: <09dcb07d-f7b8-432b-8338-840ff90faef1n@googlegroups.com>
<ss69e5$p17$1@dont-email.me>
<55bae7e8-f5da-4cfc-b0f9-284bc900d89cn@googlegroups.com>
<e6a624b6-e754-4ee5-ad7b-c82f7ef1accan@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 18 Jan 2022 12:25:27 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="4de166002d9673ed6313a248996ba33e";
logging-data="7605"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19PFdJif8OQmHzkCcoj4L1TJBnWbvBmNyU="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.3.1
Cancel-Lock: sha1:eQivevRqPsCo2xH0I04+a2p88kE=
In-Reply-To: <e6a624b6-e754-4ee5-ad7b-c82f7ef1accan@googlegroups.com>
Content-Language: en-US
 by: Jeffrey R.Carter - Tue, 18 Jan 2022 12:25 UTC

On 2022-01-18 13:08, Mark Wilson wrote:
>
> 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?

Import_Valued_Procedure is GNAT-specific, so it can do whatever they like, but
presumably this is unintended behavior and you should report it.

You should be able to work around this by making your procedure a wrapper around
an imported function with an in out parameter, with SPARK checking turned off in
the procedure body.

--
Jeff Carter
"Monsieur Arthur King, who has the brain of a duck, you know."
Monty Python & the Holy Grail
09

Re: Odd Behaviour

<2306ce86-b1da-4448-a77a-9be0f5cec9f6n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=6553&group=comp.lang.ada#6553

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a05:6214:19cd:: with SMTP id j13mr22964799qvc.125.1642508877133;
Tue, 18 Jan 2022 04:27:57 -0800 (PST)
X-Received: by 2002:a25:30c2:: with SMTP id w185mr6536055ybw.498.1642508877005;
Tue, 18 Jan 2022 04:27:57 -0800 (PST)
Path: i2pn2.org!i2pn.org!aioe.org!news.uzoreto.com!feeder1.cambriumusenet.nl!feed.tweak.nl!209.85.160.216.MISMATCH!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:27:56 -0800 (PST)
In-Reply-To: <13fa1a0d-eeed-4f44-a1ec-cace658fec0dn@googlegroups.com>
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>
<ss69e5$p17$1@dont-email.me> <55bae7e8-f5da-4cfc-b0f9-284bc900d89cn@googlegroups.com>
<e6a624b6-e754-4ee5-ad7b-c82f7ef1accan@googlegroups.com> <13fa1a0d-eeed-4f44-a1ec-cace658fec0dn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <2306ce86-b1da-4448-a77a-9be0f5cec9f6n@googlegroups.com>
Subject: Re: Odd Behaviour
From: markwil...@wilsonnet.technology (Mark Wilson)
Injection-Date: Tue, 18 Jan 2022 12:27:57 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Mark Wilson - Tue, 18 Jan 2022 12:27 UTC

On Tuesday, January 18, 2022 at 12:18:56 PM UTC, Mark Wilson wrote:
> 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 '<artificial>:(.text+0xb7): undefined reference to `sqlallochandle'''

This works!

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, "SQLAllocHandle");

pragma Import_Function
(SQLAllocHandle, "SQLAllocHandle",
(SQL_HANDLE_TYPE, SQLHANDLE, SQLHANDLE), SQLRETURN,
(Value, Value, Reference));

(so specified the external function name in the Import as well as the Import_Function)

Even the writing to an 'in' parameter worked,

Result := SQLAllocHandle
(HandleType => SQL_HANDLE_ENV,
InputHandle => SQL_NULL_HANDLE,
OutputHandlePtr => SQLHANDLE (Handle));

Put_Line (SQLRETURN'Image (Result));
Put_Line (Boolean'Image (SQLHANDLE(Handle) /= SQL_NULL_HANDLE));

The first Put_Line returns SQL_SUCCESS, and the second returns TRUE

Ugly as hell, though. Spark complains,

odbc.ads:100:04: warning: pragma "IMPORT_FUNCTION" ignored (not yet supported)
odbc.ads:139:04: warning: pragma "IMPORT_VALUED_PROCEDURE" ignored (not yet supported),

and there's the horrible Ada warning that,

main.adb:10:04: warning: variable "Handle" is read but never assigned [-gnatwv]

I think it is going to be much cleaner (and clearer) to abstract this away to an Ada body.

Re: Odd Behaviour

<d6269d17-f55d-4838-93ce-79ab2a0144f9n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=6554&group=comp.lang.ada#6554

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a05:620a:40c8:: with SMTP id g8mr4998282qko.495.1642509007467;
Tue, 18 Jan 2022 04:30:07 -0800 (PST)
X-Received: by 2002:a25:e64d:: with SMTP id d74mr3480369ybh.323.1642509007301;
Tue, 18 Jan 2022 04:30:07 -0800 (PST)
Path: i2pn2.org!i2pn.org!news.swapon.de!2.eu.feeder.erje.net!feeder.erje.net!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:30:07 -0800 (PST)
In-Reply-To: <ss6bjn$7dl$1@dont-email.me>
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>
<ss69e5$p17$1@dont-email.me> <55bae7e8-f5da-4cfc-b0f9-284bc900d89cn@googlegroups.com>
<e6a624b6-e754-4ee5-ad7b-c82f7ef1accan@googlegroups.com> <ss6bjn$7dl$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <d6269d17-f55d-4838-93ce-79ab2a0144f9n@googlegroups.com>
Subject: Re: Odd Behaviour
From: markwil...@wilsonnet.technology (Mark Wilson)
Injection-Date: Tue, 18 Jan 2022 12:30:07 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 9
 by: Mark Wilson - Tue, 18 Jan 2022 12:30 UTC

>
> You should be able to work around this by making your procedure a wrapper around
> an imported function with an in out parameter, with SPARK checking turned off in
> the procedure body.
> --

I think that has to be plan.

I'll actually do it by specifying the 'raw' imports in an Ada spec, then import that into a Spark body keeping it clean and simple.

Re: Odd Behaviour

<2e5eeb92-cc9b-43ae-8718-5cdd9774baf3n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=6555&group=comp.lang.ada#6555

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a05:620a:4489:: with SMTP id x9mr1314697qkp.633.1642513834614;
Tue, 18 Jan 2022 05:50:34 -0800 (PST)
X-Received: by 2002:a25:b906:: with SMTP id x6mr34396394ybj.372.1642513834406;
Tue, 18 Jan 2022 05:50:34 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!peer01.ams1!peer.ams1.xlned.com!news.xlned.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!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 05:50:34 -0800 (PST)
In-Reply-To: <2306ce86-b1da-4448-a77a-9be0f5cec9f6n@googlegroups.com>
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>
<ss69e5$p17$1@dont-email.me> <55bae7e8-f5da-4cfc-b0f9-284bc900d89cn@googlegroups.com>
<e6a624b6-e754-4ee5-ad7b-c82f7ef1accan@googlegroups.com> <13fa1a0d-eeed-4f44-a1ec-cace658fec0dn@googlegroups.com>
<2306ce86-b1da-4448-a77a-9be0f5cec9f6n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <2e5eeb92-cc9b-43ae-8718-5cdd9774baf3n@googlegroups.com>
Subject: Re: Odd Behaviour
From: markwil...@wilsonnet.technology (Mark Wilson)
Injection-Date: Tue, 18 Jan 2022 13:50:34 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 102
X-Received-Bytes: 4778
 by: Mark Wilson - Tue, 18 Jan 2022 13:50 UTC

Just for completeness, this is what I end up doing

SPEC:

--------------------------------------------------------------------------------
function SQL_OK
(rc : in SQLRETURN)
return Boolean
with
Global => null,
Depends => (SQL_OK'Result => (rc)),
Post => (SQL_OK'Result =
(rc = SQL_SUCCESS or rc = SQL_SUCCESS_WITH_INFO));
--------------------------------------------------------------------------------

procedure SQLAllocEnv
(hEnv : in out SQLHENV;
Result : out SQLRETURN)
with
Inline,
Global => (Output => Environment),
Depends => ((Result, hEnv, Environment) => (hEnv)),
Pre => (SQLHANDLE (hEnv) = SQL_NULL_HANDLE),
Post => (if SQL_OK (Result) then
SQLHANDLE(hEnv) /= SQL_NULL_HANDLE
else
SQLHANDLE(hEnv) = SQL_NULL_HANDLE);

--------------------------------------------------------------------------------

procedure SQLAllocDbc
(hEnv : in SQLHENV;
hDbc : in out SQLHDBC;
Result : out SQLRETURN)
with
Inline,
Global => (Input => Environment,
Output => Database_Connection),
Depends => ((Result, hDbc, Database_Connection) =>
(hEnv, hDbc, Environment)),
Pre => (SQLHANDLE (hEnv) /= SQL_NULL_HANDLE and
SQLHANDLE (hDbc) = SQL_NULL_HANDLE),
Post => (if SQL_OK (Result) then
SQLHANDLE(hDbc) /= SQL_NULL_HANDLE
else
SQLHANDLE(hDbc) = SQL_NULL_HANDLE);

--------------------------------------------------------------------------------

BODY:

--------------------------------------------------------------------------------

function SQLAllocHandle
(HandleType : in SQL_HANDLE_TYPE;
InputHandle : in SQLHANDLE;
OutputHandlePtr : in out SQLHANDLE)
return SQLRETURN
with
Import => True,
Convention => C,
External_Name => "SQLAllocHandle";

--------------------------------------------------------------------------------

function SQL_OK
(rc : in SQLRETURN)
return Boolean
is
(rc = SQL_SUCCESS or rc = SQL_SUCCESS_WITH_INFO);

--------------------------------------------------------------------------------

procedure SQLAllocEnv
(hEnv : in out SQLHENV;
Result : out SQLRETURN)
is
begin
Result := SQLAllocHandle
(HandleType => SQL_HANDLE_ENV,
InputHandle => SQL_NULL_HANDLE,
OutputHandlePtr => SQLHANDLE (hEnv));
end SQLAllocEnv;

--------------------------------------------------------------------------------

procedure SQLAllocDbc
(hEnv : in SQLHENV;
hDbc : in out SQLHDBC;
Result : out SQLRETURN)
is
begin
Result := SQLAllocHandle
(HandleType => SQL_HANDLE_DBC,
InputHandle => SQLHANDLE (hEnv),
OutputHandlePtr => SQLHANDLE (hDbc));
end SQLAllocDbc;

--------------------------------------------------------------------------------

Thanks for the help!

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor