Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 9C080637ABD for ; Tue, 24 Mar 2009 13:54:34 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 59535-09 for ; Tue, 24 Mar 2009 13:54:31 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from n25.bullet.mail.ukl.yahoo.com (n25.bullet.mail.ukl.yahoo.com [87.248.110.142]) by mail.postgresql.org (Postfix) with SMTP id 7E1A7637A8C for ; Tue, 24 Mar 2009 13:54:32 -0300 (ADT) Received: from [217.12.4.214] by n25.bullet.mail.ukl.yahoo.com with NNFMP; 24 Mar 2009 16:54:35 -0000 Received: from [87.248.110.113] by t1.bullet.ukl.yahoo.com with NNFMP; 24 Mar 2009 16:54:30 -0000 Received: from [127.0.0.1] by omp218.mail.ukl.yahoo.com with NNFMP; 24 Mar 2009 16:54:28 -0000 X-Yahoo-Newman-Property: ymail-5 X-Yahoo-Newman-Id: 224367.14836.bm@omp218.mail.ukl.yahoo.com Received: (qmail 64744 invoked by uid 60001); 24 Mar 2009 16:54:30 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.fr; s=s1024; t=1237913670; bh=W9f3Ye8QSr0euLNL6Wm3l7RkMvMTYWv14Ix1Yd0loOM=; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type; b=Bqx+6JNmUqxoc78XcDYb1E892Oru4lJZOqiMtWR6fdIRhkcAfGqlq9nV5dsM2LXqC2wKSTAYdZuh9vWKTlwM5oL0L7zXWgO8O7tTDoGwesv4bXwX2Y4NhPYAVcJ2yJw2WYFmRpea+4K5F5wT8Vqz8xK5UqGEjQ7Qff0hDJSMu0c= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.fr; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type; b=BjJDkDIqMLrABm/gVIZkInUqZbSWcBiurYXC3e3zAE16X8se0mxfvb1UoJuD9/JsI0STF928Cm+8EJu5yKE9Ich9AeiTc5IthJEryUBbdZwyiIIGlBhIoLihEAq3EdWePHQXc4/tX3vGIXaYkESp1Ws/LcfbW1b5TMS0n8Gfc2g=; Message-ID: <665164.63021.qm@web28512.mail.ukl.yahoo.com> X-YMail-OSG: c35mu7AVM1kFrSDd9oupKmDuZ8X3BZpLfGvGXVXCiBjXmJpuX1eiaawYRSCQ5P8ivc9TW2UGeK3CwYIWmYXuv8BxKkcI87BlKc.74yvgyDghrLtypFLT5lKqH5fynQv4CSDVibi_ihZcD3pevL_GKSQyiyOF05_uQsxmuS784gdnvHn3DPp7SHVILRteog-- Received: from [85.27.68.116] by web28512.mail.ukl.yahoo.com via HTTP; Tue, 24 Mar 2009 16:54:30 GMT X-Mailer: YahooMailClassic/5.1.20 YahooMailWebService/0.7.289.1 Date: Tue, 24 Mar 2009 16:54:30 +0000 (GMT) From: Ben Ali Rachid Subject: Function C and INOUT parameters To: pgsql-hackers@postgresql.org MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-339774143-1237913670=:63021" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.862 tagged_above=0 required=5 tests=AWL=0.861, HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 200903/936 X-Sequence-Number: 135614 --0-339774143-1237913670=:63021 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Hello,=20 I posted my problem (on pgsql-interfaces list) about the INOUT parameters o= n PostgreSQL 8.3.6 (Win32), but without success. I re-post my question here= , while hoping to have more success. When I use a function with one INOUT (or OUT) parameter like below, everyti= ng is OK. CREATE OR REPLACE FUNCTION add_one(INOUT arg integer) =0ARETURNS integer=A0 AS '$libdir/myDLL.dll', 'add_one' =0ALANGUAGE 'c' VOLATILE STRICT ; // In 'myDLL' void add_one(int arg) =0A{ =0A=09arg =3D arg + 1 ; =0A} select * from add_one(10) ;=A0 // OK But when I use 2 or more INOUT (or OUT) parameters like below, the server c= rashes with exception 0xC0000005 (access violation).=20 CREATE OR REPLACE FUNCTION add_one(INOUT arg1 integer, INOUT arg2 integer) =0ARETURNS record=A0 AS '$libdir/myDLL.dll', 'add_one' =0ALANGUAGE 'c' VOLATILE STRICT ; void add_one(int arg1, int arg2) =0A{ =0A=09arg1 =3D arg1 + 1 ; =0A=09arg2 =3D arg2 + 1 ; =0A} select * from add_one(10, 20);=A0 // CRASH I probably understood something wrong with the INOUT parameter. Is there so= meone to help me ? Thanks. =0A=0A=0A --0-339774143-1237913670=:63021 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable
Hello,

I posted my problem (on pgsql-= interfaces list) about the INOUT parameters on PostgreSQL 8.3.6 (Win32), bu= t without success. I re-post my question here, while hoping to have more su= ccess.

When I use a function with one INOUT (or OUT) parameter like = below, everyting is OK.

CREATE OR REPLACE FUNCTION= add_one(INOUT arg integer)
=0ARETURNS integer  AS '$libdir/myDLL.d= ll', 'add_one'
=0ALANGUAGE 'c' VOLATILE STRICT ;


// In 'myD= LL'
void add_one(int arg)
=0A{
=0A=09arg =3D arg + 1 ;
=0A}

select * from add_one(10) ;  // OK

But when I use 2 or more INOUT (or OUT) par= ameters like below, the server crashes with exception 0xC0000005 (access vi= olation).

CREATE OR REPLACE FUNCTION add_one(INOUT arg1 inte= ger, INOUT arg2 integer)
=0ARETURNS record  AS '$libdir/myDLL.dll', 'add_one'
=0ALANGUAGE 'c' VOLATI= LE STRICT ;

void add_one(int arg1, int arg2)
=0A= {
=0A=09arg1 =3D arg1 + 1 ;
=0A=09arg2 =3D arg2 + 1 ;
=0A}
=

select * from add_one(10, 20);  // CRASH

I probab= ly understood something wrong with the INOUT parameter. Is there someone to= help me ? Thanks.


=0A=0A=0A=0A --0-339774143-1237913670=:63021--