Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 7B4B96402DC for ; Tue, 24 Mar 2009 15:15:41 -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 79760-09-2 for ; Tue, 24 Mar 2009 15:15:35 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from exprod7og110.obsmtp.com (exprod7og110.obsmtp.com [64.18.2.173]) by mail.postgresql.org (Postfix) with SMTP id 9DDA06336A7 for ; Tue, 24 Mar 2009 15:11:20 -0300 (ADT) Received: from source ([209.85.220.177]) by exprod7ob110.postini.com ([64.18.6.12]) with SMTP ID DSNKSckiRSUzh7PLIO+oAir4CbWyfAyA80UP@postini.com; Tue, 24 Mar 2009 11:11:20 PDT Received: by mail-fx0-f177.google.com with SMTP id 25so2365809fxm.10 for ; Tue, 24 Mar 2009 11:11:17 -0700 (PDT) MIME-Version: 1.0 Received: by 10.223.118.9 with SMTP id t9mr7355930faq.20.1237918277466; Tue, 24 Mar 2009 11:11:17 -0700 (PDT) In-Reply-To: <665164.63021.qm@web28512.mail.ukl.yahoo.com> References: <665164.63021.qm@web28512.mail.ukl.yahoo.com> Date: Tue, 24 Mar 2009 18:11:17 +0000 Message-ID: <4136ffa0903241111r4d552600h876839b9e3b65e3c@mail.gmail.com> Subject: Re: Function C and INOUT parameters From: Greg Stark To: Ben Ali Rachid Cc: pgsql-hackers@postgresql.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200903/938 X-Sequence-Number: 135616 On Tue, Mar 24, 2009 at 4:54 PM, Ben Ali Rachid wrot= e: > Hello, > > I posted my problem (on pgsql-interfaces list) about the INOUT parameters= on > PostgreSQL 8.3.6 (Win32), but without success. I re-post my question here= , > while hoping to have more success. Personally I'm of the opinion we should eliminate most of these duplicative mailing lists like -performance and -interfaces and just use -general. I don't see that having multiple lists for user questions helps either the users or the answerers due to just this type of problem. > 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) > RETURNS integer=A0 AS '$libdir/myDLL.dll', 'add_one' > LANGUAGE 'c' VOLATILE STRICT ; > > // In 'myDLL' > void add_one(int arg) a) you should probably be using V1 calling api rather than V0. see http://www.postgresql.org/docs/8.3/interactive/xfunc-c.html#AEN40901 b) you need to arrange for the C function to return a record with all the returned fields. You can't just set the parameters to new values and return void. The api to return a record is at: http://www.postgresql.org/docs/8.3/interactive/xfunc-c.html#AEN41361 --=20 greg