I need example of c++ function for postgres

Поиск
Список
Период
Сортировка
От Yuriy Rusinov
Тема I need example of c++ function for postgres
Дата
Msg-id 3F0AB227.5040000@quasar.ipa.nw.ru
обсуждение исходный текст
Список 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 по дате отправления:

Предыдущее
От: Jason Tishler
Дата:
Сообщение: Re: installation question
Следующее
От: Seth Rubin
Дата:
Сообщение: Win XP Install README