Re: Add PGDLLEXPORT to PG_FUNCTION_INFO_V1 - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Add PGDLLEXPORT to PG_FUNCTION_INFO_V1
Date
Msg-id 5586.1476276329@sss.pgh.pa.us
Whole thread Raw
In response to Add PGDLLEXPORT to PG_FUNCTION_INFO_V1  (Albe Laurenz <laurenz.albe@wien.gv.at>)
Responses Re: Add PGDLLEXPORT to PG_FUNCTION_INFO_V1  (Albe Laurenz <laurenz.albe@wien.gv.at>)
List pgsql-hackers
Albe Laurenz <laurenz.albe@wien.gv.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



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: macaddr 64 bit (EUI-64) datatype support
Next
From: Julien Rouhaud
Date:
Subject: Re: macaddr 64 bit (EUI-64) datatype support