pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: spanu_andrea@yahoo.it
To: pgsql-bugs@postgresql.org
Subject: BUG #14489: PG_FUNCTION_INFO_V1(funcname) is not bomb proof
Date: Mon, 09 Jan 2017 12:30:35 +0000
Message-ID: <20170109123035.24286.58529@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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


Message-ID: <20170109123035.24286.58529@wrigleys.postgresql.org>
Permalink:  ../20170109123035.24286.58529@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/20170109123035.24286.58529@wrigleys.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: spanu_andrea@yahoo.it
  Subject: Re: BUG #14489: PG_FUNCTION_INFO_V1(funcname) is not bomb proof
  In-Reply-To: <20170109123035.24286.58529@wrigleys.postgresql.org>
  References: <20170109123035.24286.58529@wrigleys.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox