postgres functions and C++

From: "Vladimir V(dot) Zolotych" <gsmith(at)eurocom(dot)od(dot)ua>
To: pgsql-hackers(at)postgresql(dot)org
Subject: postgres functions and C++
Date: 2000-10-04 08:59:06
Message-ID: 8541.001004@eurocom.od.ua
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello all,

Please help me with
create function days_in_month(int4, int4, int4) returns int4
as '/tmp/days.so' language 'c';

Can I write this function days_in_month in C++ ?
I've did the following:

extern "C" {
int days_in_month(int year, int mo, int day);
}

extern "C" {
int days_in_month(int year, int mo, int day) {
═══ return 13;
}
}

Compile with
$ g++ -I/usr/local/qt/include -o days.so -shared days.cpp

then (as user postgres)
my=> create function days_in_month(int4, int4, int4) returns int4
my=> as '/tmp/days.so' language 'c';
CREATE

I've tried to use new function
my=> select days_in_month(3, 3, 3);
ERROR:═ Can't find function days_in_month in file /tmp/days.so
my=>

What is wrong ?
I'm using postgres 6.4 under RedHat.
Any help will be appreciated.

--
Best regards,
Vladimir mailto:gsmith(at)eurocom(dot)od(dot)ua

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jan Wieck 2000-10-04 10:33:46 Re: Solution for RI permission problem
Previous Message Milan Sorm 2000-10-04 08:03:03 Re: www.postgresql.org