From: Ben Ali Rachid <souliman239@yahoo.fr>
To: pgsql-interfaces@postgresql.org
Subject: Function C and INOUT parameters
Date: Wed, 18 Mar 2009 13:13:23 +0000 (GMT)
Message-ID: <238982.46441.qm@web28504.mail.ukl.yahoo.com> (raw)
Hello,
I have created a function (on Windows XP) in PostgreSQL 8.3.6 with 2 inout parameters. His code is :
CREATE OR REPLACE FUNCTION add_one(INOUT arg1 integer, INOUT arg2 integer)
RETURNS record
AS '$libdir/myDLL.dll', 'add_one'
LANGUAGE 'c' VOLATILE STRICT ;
In my DLL (created with Visual Studio Pro 2008), I have a function C (it's just a test function) :
void add_one(int arg1, int arg2)
{
arg1 = arg1 + 1 ;
arg2 = arg2 + 1 ;
}
When I try to execute my function (select * from add_one(10, 20)), the server crashes . The problem is that if I use a function with one INOUT parameter like this :
CREATE OR REPLACE FUNCTION add_one(INOUT arg integer)
RETURNS integer
AS '$libdir/myDLL.dll', 'add_one'
LANGUAGE 'c' VOLATILE STRICT ;
void add_one(int arg)
{
arg = arg + 1 ;
}
, everything is OK. I think the problem is related to "RETURNS record", but I have no idea to solve it
Any idea ?
Thanks
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-interfaces@postgresql.org
Cc: souliman239@yahoo.fr
Subject: Re: Function C and INOUT parameters
In-Reply-To: <238982.46441.qm@web28504.mail.ukl.yahoo.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox