>
>
> I don't think that's necessary, per above. You just have to access the
> vars via pointer indirection always, so long as *any* Pg version you
> support has ever lacked dllexport or DEF entry, so you can't dllimport the
> var.
>
> You could enable direct dllimport if PG_VERSION_NUM shows you're on a new
> enough version, but you'd need to use conditionally compiled inlines or
> something to switch between the methods of accessing it, so there's not
> much point. You just declare
>
> extern int* log_min_messages_p;
>
> ... and use that, probably also #define'ing log_min_messages away after
> including the Pg headers so that you can't reference it accidentally.
>


Actually, if __declspec(dllexport) or a .DEF entry was added in, say,
9.4.5, you could probably just:

#if PG_VERSION_NUM < 90405
extern int* log_min_messages_p;
#define log_min_messages (*log_min_messages_p)
#endif

after including all PostgreSQL headers. It won't work for inline functions
defined in PostgreSQL headers, but should otherwise be OK I think.

(again, untested)

-- 
 Craig Ringer                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services

Reply via email to