I need example of c++ function for postgres

From: Yuriy Rusinov <rusinov(at)quasar(dot)ipa(dot)nw(dot)ru>
To: pgsql-cygwin(at)postgresql(dot)org
Subject: I need example of c++ function for postgres
Date: 2003-07-08 11:59:35
Message-ID: 3F0AB227.5040000@quasar.ipa.nw.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-cygwin

Hello, everyone !

I have developed function for postgresql, compile it, make .so-file and
when I try to link this function to a database it was an error "Cannot
find function weight_ave in <file>.so". Here is code of this function:

weight_ave.h :

#ifndef _WEIGHTAVE_H
#define _WEIGHTAVE_H

double weight_ave (const double* const w, const double* const x, int n);

#endif

weight_ave.cpp:

#include "weight_ave.h"

double weight_ave (const double* const w, const double* const x, int n)
{
double sumx=0.0;
double sumw=0.0;
for (int i=0; i<n; i++)
{
sumx+=w[i]*x[i];
sumw+=w[i];
}
return sumx/sumw;
}

what files I have to include and which way I have to declare this
function on include.

Best regards,
Sincerely yours,
Yuriy Rusinov.

Browse pgsql-cygwin by date

  From Date Subject
Next Message Henshall, Stuart - TNP Southwest 2003-07-08 13:16:32 Re: I need example of c++ function for postgres
Previous Message Jason Tishler 2003-07-08 11:55:02 Re: installation question