Add PGDLLEXPORT to PG_FUNCTION_INFO_V1 - Mailing list pgsql-hackers

From Albe Laurenz
Subject Add PGDLLEXPORT to PG_FUNCTION_INFO_V1
Date
Msg-id A737B7A37273E048B164557ADEF4A58B539300BD@ntex2010a.host.magwien.gv.at
Whole thread Raw
Responses Re: Add PGDLLEXPORT to PG_FUNCTION_INFO_V1  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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

pgsql-hackers by date:

Previous
From: Julien Rouhaud
Date:
Subject: Re: macaddr 64 bit (EUI-64) datatype support
Next
From: Heikki Linnakangas
Date:
Subject: Re: Comment typo