public inbox for [email protected]  
help / color / mirror / Atom feed
From: Ben Ali Rachid <[email protected]>
To: [email protected]
Subject: Function C and INOUT parameters
Date: Tue, 24 Mar 2009 16:54:30 +0000 (GMT)
Message-ID: <[email protected]> (raw)

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.

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  AS '$libdir/myDLL.dll', 'add_one'

LANGUAGE 'c' VOLATILE STRICT ;

// In 'myDLL'
void add_one(int arg)

{

	arg = arg + 1 ;

}

select * from add_one(10) ;  // OK

But when I use 2 or more INOUT (or OUT) parameters like below, the server crashes with exception 0xC0000005 (access violation). 

CREATE OR REPLACE FUNCTION add_one(INOUT arg1 integer, INOUT arg2 integer)

RETURNS record  AS '$libdir/myDLL.dll', 'add_one'

LANGUAGE 'c' VOLATILE STRICT ;

void add_one(int arg1, int arg2)

{

	arg1 = arg1 + 1 ;

	arg2 = arg2 + 1 ;

}

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

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






view thread (16+ messages)  latest in thread

reply

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: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: Function C and INOUT parameters
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox