Re: [GENERAL] Trying to make functions in 'C' - Mailing list pgsql-general

From selkovjr.mcs.anl.gov@mcs.anl.gov
Subject Re: [GENERAL] Trying to make functions in 'C'
Date
Msg-id 199905171658.LAA10439@antares.mcs.anl.gov
Whole thread Raw
In response to Re: [GENERAL] Trying to make functions in 'C'  (tolik@icomm.ru (Anatoly K. Lasareff))
List pgsql-general
> >>>>> "fb" == fabian baena <fabbaena@hotmail.com> writes:
>
>  fb> I'm tying to learn how to make function in 'C'.
>  fb> I'm trying to compile a program I made in 'C'.
>  fb> The function I made looks like this:
>
>  fb> #include "postgres.h"
>
>  fb> int
>  fb> add_one(int arg)
>  fb> {
>  fb> return arg + 1;
>  fb> }
>
> Pehaps not 'int', but 'int4' in argument and return type? Except this
> I think your example is right.

As far as return types, make sure you get what you want by
checking how types are typedef'ed in postgres.h

The safest way to add your own code would be what Fabian is trying to
accomplish -- by using the prototypes from tutorial.


--Gene

pgsql-general by date:

Previous
From: jim@reptiles.org (Jim Mercer)
Date:
Subject: detecting locks
Next
From: cardoso.a@mail.telepac.pt (Augusto Cardoso)
Date:
Subject: [Q] Can't generate C prog.with ecpg ------- Help please!