[BUGS] BUG #14489: PG_FUNCTION_INFO_V1(funcname) is not bomb proof

Поиск
Список
Период
Сортировка
От spanu_andrea@yahoo.it
Тема [BUGS] BUG #14489: PG_FUNCTION_INFO_V1(funcname) is not bomb proof
Дата
Msg-id 20170109123035.24286.58529@wrigleys.postgresql.org
обсуждение исходный текст
Список pgsql-bugs
The following bug has been logged on the website:

Bug reference:      14489
Logged by:          Spanu Andrea
Email address:      spanu_andrea@yahoo.it
PostgreSQL version: 9.6.1
Operating system:   Windows
Description:

So, I sent few time ago a query for a clarification about the impossibility
to use the palloc() erreport() and company functions in mingw on windows.
Mr. Tom Lane answer me to user MSVC. I used MSVC. I don't like him and he
doesn't like me. After a week lost to understand that a phantomatic error,
were caused from the fact I did not declare a variable at the top of the
function. Endly compile. When run, PostgreSQL could not find the
functions... After several attempts endly I solved. 
I modified (coool I am an HAAACKER):
#define PG_FUNCTION_INFO_V1(funcname) \
extern Datum funcname(PG_FUNCTION_ARGS); \
extern PGDLLEXPORT const Pg_finfo_record *
CppConcat(pg_finfo_,funcname)(void); \
const Pg_finfo_record * \
CppConcat(pg_finfo_,funcname) (void) \
{ \
    static const Pg_finfo_record my_finfo = { 1 }; \
    return &my_finfo; \
} \
extern int no_such_variable

TO :
#define PG_FUNCTION_INFO_V1(funcname) \
extern PGDLLEXPORT Datum funcname(PG_FUNCTION_ARGS); \
extern PGDLLEXPORT const Pg_finfo_record *
CppConcat(pg_finfo_,funcname)(void); \
const Pg_finfo_record * \
CppConcat(pg_finfo_,funcname) (void) \
{ \
    static const Pg_finfo_record my_finfo = { 1 }; \
    return &my_finfo; \
} \
extern int no_such_variable

I declared PGDLLEXPORT also the declaration of my function.
Now works. In fact I don't really know if some weird setting should be done
in MSVC, because mingw didn't throw me any exception... but, I mean... I
would just let you to know, that there is some work to do.


--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

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

Предыдущее
От: "sin"
Дата:
Сообщение: [BUGS] have you seen that stuff?
Следующее
От: mr@marcelruff.info
Дата:
Сообщение: [BUGS] BUG #14490: psql and createdb crash with SIGSEGV