Trying to make functions in 'C' - Mailing list pgsql-general

From fabian baena
Subject Trying to make functions in 'C'
Date
Msg-id 19990516162326.84206.qmail@hotmail.com
Whole thread Raw
Responses Re: [GENERAL] Trying to make functions in 'C'  (selkovjr@mcs.anl.gov)
List pgsql-general
I'm tying to learn how to make function in 'C'.
I'm trying to compile a program I made in 'C'.
The command I gave were:

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

and created the function in postgres like this:

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


The function I made looks like this:

#include "postgres.h"

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

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

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

Thank you.


Fabian.


______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

pgsql-general by date:

Previous
From: Chris Bitmead
Date:
Subject: Re: [GENERAL] RH 6.0 and PostgreSQL
Next
From: selkovjr@mcs.anl.gov
Date:
Subject: Re: [GENERAL] Trying to make functions in 'C'