pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Vladimir V. Zolotych <gsmith@eurocom.od.ua>
To: pgsql-admin@postgresql.org
Subject: postgres C++ functions
Date: Wed, 4 Oct 2000 11:24:22 +0400
Message-ID: <0475.001004@eurocom.od.ua> (raw)

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@eurocom.od.ua





Message-ID: <0475.001004@eurocom.od.ua>
Permalink:  ../0475.001004@eurocom.od.ua/
Also on:    postgresql.org/message-id/0475.001004@eurocom.od.ua

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: gsmith@eurocom.od.ua
  Subject: Re: postgres C++ functions
  In-Reply-To: <0475.001004@eurocom.od.ua>
  References: <0475.001004@eurocom.od.ua>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox