Add PGDLLEXPORT to PG_FUNCTION_INFO_V1

From: Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: "'pgsql-hackers(at)postgresql(dot)org'" <pgsql-hackers(at)postgresql(dot)org>
Subject: Add PGDLLEXPORT to PG_FUNCTION_INFO_V1
Date: 2016-10-12 09:09:05
Message-ID: A737B7A37273E048B164557ADEF4A58B539300BD@ntex2010a.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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?

It would do the right thing on Windows and save people the trouble of
either using an export definition file or re-declaring the function with
the PGDLLEXPORT decoration.
An SQL function that is not exported does not make much sense, right?

BTW, I admit I don't understand the comment. What does PGDLLIMPORT do
for a dynamically loaded function?

I propose the attached patch.

Yours,
Laurenz Albe

Attachment Content-Type Size
0001-Add-PGDLLEXPORT-to-function-declaration-in-PG_FUNCTI.patch application/octet-stream 989 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2016-10-12 09:10:27 Re: Comment typo
Previous Message Julien Rouhaud 2016-10-12 08:42:20 Re: macaddr 64 bit (EUI-64) datatype support