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

Поиск
Список
Период
Сортировка
От selkovjr.mcs.anl.gov@mcs.anl.gov
Тема Re: [GENERAL] Trying to make functions in 'C'
Дата
Msg-id 199905171658.LAA10439@antares.mcs.anl.gov
обсуждение исходный текст
Ответ на Re: [GENERAL] Trying to make functions in 'C'  (tolik@icomm.ru (Anatoly K. Lasareff))
Список 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 по дате отправления:

Предыдущее
От: jim@reptiles.org (Jim Mercer)
Дата:
Сообщение: detecting locks
Следующее
От: cardoso.a@mail.telepac.pt (Augusto Cardoso)
Дата:
Сообщение: [Q] Can't generate C prog.with ecpg ------- Help please!