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

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.

Laurenz Albe

Attachment: 0001-Add-PGDLLEXPORT-to-function-declaration-in-PG_FUNCTI.patch
Description: 0001-Add-PGDLLEXPORT-to-function-declaration-in-PG_FUNCTI.patch

Sent via pgsql-hackers mailing list (
To make changes to your subscription:

Reply via email to