>>>>> "fb" == fabian baena <[EMAIL PROTECTED]> 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:       [EMAIL PROTECTED] 
Senior programmer

Reply via email to