Re: PostgreSQL C Language Extension with C++ Code

Поиск
Список
Период
Сортировка
От Dmitry Igrishin
Тема Re: PostgreSQL C Language Extension with C++ Code
Дата
Msg-id CAAfz9KNP0QX_5KX-Tg+paY6YRcKTrz6u2hUQ1zEzw04MNfRMeQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: PostgreSQL C Language Extension with C++ Code  (TalGloz <glozmantal@gmail.com>)
Список pgsql-general
вс, 12 авг. 2018 г. в 21:40, TalGloz <glozmantal@gmail.com>:
>
> I did it with the macros
>
> extern "C" {
> Datum sum_of_numbers(PG_FUNCTION_ARGS);
> PG_FUNCTION_INFO_V1(sum_of_numbers);
> }
>
> But now my compiler throws some other errors when running make:
>
> g++ --std=c++17 -fPIC -Wall -Werror -g3 -O0 -o myfunc.o -c myfunc.cpp
> -I/usr/pgsql-10/include/server -L"/usr/local/lib/libseal.a"
> -I"/usr/local/include/seal" -I"/usr/local/include/cppcodec"
> myfunc.cpp:29:10: error: conflicting declaration of C function ‘int64_t
> sum_of_numbers()’
>   int64_t sum_of_numbers(){
>           ^~~~~~~~~~~~~~
> In file included from /usr/pgsql-10/include/server/utils/array.h:64,
>                  from /usr/pgsql-10/include/server/utils/acl.h:38,
>                  from
> /usr/pgsql-10/include/server/catalog/objectaddress.h:18,
>                  from
> /usr/pgsql-10/include/server/catalog/pg_publication.h:21,
>                  from /usr/pgsql-10/include/server/utils/rel.h:21,
>                  from myfunc.cpp:3:
> myfunc.cpp:25:21: note: previous declaration ‘Datum
> sum_of_numbers(FunctionCallInfo)’
>  PG_FUNCTION_INFO_V1(sum_of_numbers);
>                      ^~~~~~~~~~~~~~
> /usr/pgsql-10/include/server/fmgr.h:374:14: note: in definition of macro
> ‘PG_FUNCTION_INFO_V1’
>  extern Datum funcname(PG_FUNCTION_ARGS); \
>               ^~~~~~~~
> make: *** [Makefile:16: myfunc.o] Error 1
>
> Why is it so hard to use C++ with PostgerSQL for a C extension? :)
It is not.


В списке pgsql-general по дате отправления:

Предыдущее
От: TalGloz
Дата:
Сообщение: Re: PostgreSQL C Language Extension with C++ Code
Следующее
От: "Phil Endecott"
Дата:
Сообщение: Re: Replication failure, slave requesting old segments