Re: [GENERAL] Trying to make functions in 'C'

From: selkovjr(dot)mcs(dot)anl(dot)gov(at)mcs(dot)anl(dot)gov
To: tolik(at)icomm(dot)ru (Anatoly K(dot) Lasareff), pgsql-general(at)postgreSQL(dot)org
Subject: Re: [GENERAL] Trying to make functions in 'C'
Date: 1999-05-17 16:00:00
Message-ID: 199905171658.LAA10439@antares.mcs.anl.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> >>>>> "fb" == fabian baena <fabbaena(at)hotmail(dot)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

Browse pgsql-general by date

  From Date Subject
Next Message Jim Mercer 1999-05-17 16:08:20 detecting locks
Previous Message Chris Bitmead 1999-05-17 13:48:24 Re: [GENERAL] DELETE COLUMN function