Re: Add PGDLLEXPORT to PG_FUNCTION_INFO_V1

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: Add PGDLLEXPORT to PG_FUNCTION_INFO_V1
Date: 2016-10-12 12:45:29
Message-ID: 5586.1476276329@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at> writes:
> Currently, PG_FUNCTION_INFO_V1 is defined as
> /*
> * Macro to build an info function associated with the given function name.
> * Win32 loadable functions usually link with 'dlltool --export-all', but it
> * doesn't hurt to add PGDLLIMPORT in case they don't.
> */
> #define PG_FUNCTION_INFO_V1(funcname) \
> 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

> Is there a good reason why the "funcname" declaration is not decorated
> with PGDLLEXPORT?

The lack of complaints about this suggest that it's not actually necessary
to do so. So what this makes me wonder is whether we can't drop the
DLLEXPORT on the finfo function too. I'd rather reduce the number of
Microsoft-isms in the code, not increase it.

> BTW, I admit I don't understand the comment.

It seems like an obvious typo. Or, possibly, sloppy thinking that
contributed to failure to recognize that the keyword isn't needed.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Julien Rouhaud 2016-10-12 12:50:51 Re: macaddr 64 bit (EUI-64) datatype support
Previous Message Tom Lane 2016-10-12 12:33:00 Re: macaddr 64 bit (EUI-64) datatype support