Received: from fido.inet-interactif.com (fido.inet-interactif.com [216.218.2.225]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f25Lwrx48166; Mon, 5 Mar 2001 16:58:53 -0500 (EST) (envelope-from boulat@inet-interactif.com) Received: from inet-interactif.com ([216.218.2.229]) by fido.inet-interactif.com (8.9.3/8.9.3) with ESMTP id QAA19314; Mon, 5 Mar 2001 16:58:50 -0500 (EST) (envelope-from boulat@inet-interactif.com) Message-ID: <3AA40C7F.D56684AF@inet-interactif.com> Date: Mon, 05 Mar 2001 17:00:31 -0500 From: Boulat Khakimov Organization: Inet Interactif Inc. X-Mailer: Mozilla 4.76 [en] (X11; U; Linux 2.2.18 i686) X-Accept-Language: en MIME-Version: 1.0 To: pgsql-sql@postgresql.org, pgsql-docs@postgresql.org Subject: Extending PostgreSQL Using C Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200103/16 X-Sequence-Number: 447 Hi, Im writing a C function for PG to do one way encryption using crypt. Here is the source code #include #include #include "postgres.h" #include "utils/builtins.h" text *encrypt(text *string){ text *ret; int m; if ((string == (text *) NULL) || ((m = VARSIZE(string) - VARHDRSZ) <= 0)) return string; ret = (text *) palloc(20); ret = (text *) crypt(string,"AB"); return ret; } then I compile it like so: gcc -I/usr/src/postgresql-7.0.3/src/include \ -I/usr/src/postgresql-7.0.3/src/backend -O2 -Wall -Wmissing-prototypes \ -Wmissing-declarations \ -I/usr/src/postgresql-7.0.3/src/interfaces/libpq \ -I/usr/src/postgresql-7.0.3/src/include -fpic -c -o encrypt.o encrypt.c gcc -shared -o encrypt.so encrypt.o rm encrypt.o then in PG, I do the following test=> CREATE FUNCTION encrypt(text) test->RETURNS text test->AS '/[full path here]/encrypt.so' test->LANGUAGE 'C'; CREATE Now when I try test=> SELECT encrypt('Blah'); it gives me this error ERROR: Can't find function encrypt in file /[full path here]/encrypt.so Why do I get this error???? Any ideas? Regards, Boulat Khakimov -- Nothing Like the Sun