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

From: spanu_andrea(at)yahoo(dot)it
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #14489: PG_FUNCTION_INFO_V1(funcname) is not bomb proof
Date: 2017-01-09 12:30:35
Message-ID: 20170109123035.24286.58529@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 14489
Logged by: Spanu Andrea
Email address: spanu_andrea(at)yahoo(dot)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.

Browse pgsql-bugs by date

  From Date Subject
Next Message mr 2017-01-10 20:29:53 BUG #14490: psql and createdb crash with SIGSEGV
Previous Message sin 2017-01-08 11:51:04 have you seen that stuff?