pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: tolik@icomm.ru
To: fabian baena <fabbaena@hotmail.com>
Cc: pgsql-general@postgreSQL.org
Subject: Re: [GENERAL] Trying to make functions in 'C'
Date: 17 May 1999 10:46:56 +0400
Message-ID: <87n1z46vmn.fsf@tolikus.hq.aaanet.ru> (raw)
References: <19990516162326.84206.qmail@hotmail.com>

>>>>> "fb" == fabian baena <fabbaena@hotmail.com> writes:

 fb> I'm tying to learn how to make function in 'C'.
 fb> I'm trying to compile a program I made in 'C'.
 fb> The command I gave were:

 fb> % gcc -fPIC -c addone.c -I/usr/local/pgsql/include
 fb> % ld -G -Bdynamic -o addone.so addone.o

 fb> and created the function in postgres like this:

 fb> CREATE FUNCTION add_one(int4) RETURNS int4
 fb> AS './addone.so' LANGUAGE 'c';


 fb> The function I made looks like this:

 fb> #include "postgres.h"

 fb> int
 fb> add_one(int arg)
 fb> {
 fb> return arg + 1;
 fb> }

 fb> But when I try to test the function in postgres I recieve this error:

 fb> ERROR:  stat failed on file ./addone.so
 fb> ERROR:  stat failed on file ./addone.so
 fb> Can anyone tell where did I make a mistake?
 fb> I have a linux on a PC.

Pehaps not 'int', but 'int4' in argument and return type? Except this
I think your example is right.

-- 
Anatoly K. Lasareff              Email:       tolik@icomm.ru 
Senior programmer



view thread (5+ messages)  latest in thread

Message-ID: <87n1z46vmn.fsf@tolikus.hq.aaanet.ru>
Permalink:  ../87n1z46vmn.fsf@tolikus.hq.aaanet.ru/
Also on:    postgresql.org/message-id/87n1z46vmn.fsf@tolikus.hq.aaanet.ru

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: tolik@icomm.ru, fabbaena@hotmail.com
  Subject: Re: [GENERAL] Trying to make functions in 'C'
  In-Reply-To: <87n1z46vmn.fsf@tolikus.hq.aaanet.ru>
  References: <19990516162326.84206.qmail@hotmail.com> <87n1z46vmn.fsf@tolikus.hq.aaanet.ru>

* 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