Received: from tolikus.hq.aaanet.ru (tolikus.hq.aaanet.ru [195.151.212.227]) by hub.org (8.9.3/8.9.3) with ESMTP id CAA26486 for ; Mon, 17 May 1999 02:48:11 -0400 (EDT) (envelope-from tolik@tolikus.hq.aaanet.ru) Received: (from tolik@localhost) by tolikus.hq.aaanet.ru (8.9.1/8.9.1) id KAA11904; Mon, 17 May 1999 10:46:58 +0400 (MSD) (envelope-from tolik) To: "fabian baena" Cc: pgsql-general@postgreSQL.org Subject: Re: [GENERAL] Trying to make functions in 'C' References: <19990516162326.84206.qmail@hotmail.com> Mime-Version: 1.0 (generated by tm-edit 7.108) Content-Type: text/plain; charset=US-ASCII From: tolik@icomm.ru (Anatoly K. Lasareff) Date: 17 May 1999 10:46:56 +0400 In-Reply-To: "fabian baena"'s message of "Sun, 16 May 1999 11:23:25 COT" Message-ID: <87n1z46vmn.fsf@tolikus.hq.aaanet.ru> Lines: 38 X-Mailer: Gnus v5.5/XEmacs 20.4 - "Emerald" >>>>> "fb" == fabian baena 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