I need example of c++ function for postgres - Mailing list pgsql-cygwin

From Yuriy Rusinov
Subject I need example of c++ function for postgres
Date
Msg-id 3F0AB227.5040000@quasar.ipa.nw.ru
Whole thread Raw
List 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.


pgsql-cygwin by date:

Previous
From: Jason Tishler
Date:
Subject: Re: installation question
Next
From: Seth Rubin
Date:
Subject: Win XP Install README