Skip to content

Commit 33cb96b

Browse files
committed
Revert "Provide DLLEXPORT markers for C functions via PG_FUNCTION_INFO_V1 macro."
This reverts commit c8ead2a. Seems there is no way to do this that doesn't cause MSVC to give warnings, so let's just go back to the way we've been doing it. Discussion: <[email protected]>
1 parent 77517ba commit 33cb96b

File tree

4 files changed

+25
-41
lines changed

4 files changed

+25
-41
lines changed

contrib/hstore/hstore.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ extern Pairs *hstoreArrayToPairs(ArrayType *a, int *npairs);
194194
#if HSTORE_POLLUTE_NAMESPACE
195195
#define HSTORE_POLLUTE(newname_,oldname_) \
196196
PG_FUNCTION_INFO_V1(oldname_); \
197-
extern PGDLLEXPORT Datum newname_(PG_FUNCTION_ARGS); \
197+
Datum newname_(PG_FUNCTION_ARGS); \
198198
Datum oldname_(PG_FUNCTION_ARGS) { return newname_(fcinfo); } \
199199
extern int no_such_variable
200200
#else

contrib/ltree/ltree.h

+20-20
Original file line numberDiff line numberDiff line change
@@ -130,30 +130,30 @@ typedef struct
130130

131131

132132
/* use in array iterator */
133-
extern PGDLLEXPORT Datum ltree_isparent(PG_FUNCTION_ARGS);
134-
extern PGDLLEXPORT Datum ltree_risparent(PG_FUNCTION_ARGS);
135-
extern PGDLLEXPORT Datum ltq_regex(PG_FUNCTION_ARGS);
136-
extern PGDLLEXPORT Datum ltq_rregex(PG_FUNCTION_ARGS);
137-
extern PGDLLEXPORT Datum lt_q_regex(PG_FUNCTION_ARGS);
138-
extern PGDLLEXPORT Datum lt_q_rregex(PG_FUNCTION_ARGS);
139-
extern PGDLLEXPORT Datum ltxtq_exec(PG_FUNCTION_ARGS);
140-
extern PGDLLEXPORT Datum ltxtq_rexec(PG_FUNCTION_ARGS);
141-
extern PGDLLEXPORT Datum _ltq_regex(PG_FUNCTION_ARGS);
142-
extern PGDLLEXPORT Datum _ltq_rregex(PG_FUNCTION_ARGS);
143-
extern PGDLLEXPORT Datum _lt_q_regex(PG_FUNCTION_ARGS);
144-
extern PGDLLEXPORT Datum _lt_q_rregex(PG_FUNCTION_ARGS);
145-
extern PGDLLEXPORT Datum _ltxtq_exec(PG_FUNCTION_ARGS);
146-
extern PGDLLEXPORT Datum _ltxtq_rexec(PG_FUNCTION_ARGS);
147-
extern PGDLLEXPORT Datum _ltree_isparent(PG_FUNCTION_ARGS);
148-
extern PGDLLEXPORT Datum _ltree_risparent(PG_FUNCTION_ARGS);
133+
Datum ltree_isparent(PG_FUNCTION_ARGS);
134+
Datum ltree_risparent(PG_FUNCTION_ARGS);
135+
Datum ltq_regex(PG_FUNCTION_ARGS);
136+
Datum ltq_rregex(PG_FUNCTION_ARGS);
137+
Datum lt_q_regex(PG_FUNCTION_ARGS);
138+
Datum lt_q_rregex(PG_FUNCTION_ARGS);
139+
Datum ltxtq_exec(PG_FUNCTION_ARGS);
140+
Datum ltxtq_rexec(PG_FUNCTION_ARGS);
141+
Datum _ltq_regex(PG_FUNCTION_ARGS);
142+
Datum _ltq_rregex(PG_FUNCTION_ARGS);
143+
Datum _lt_q_regex(PG_FUNCTION_ARGS);
144+
Datum _lt_q_rregex(PG_FUNCTION_ARGS);
145+
Datum _ltxtq_exec(PG_FUNCTION_ARGS);
146+
Datum _ltxtq_rexec(PG_FUNCTION_ARGS);
147+
Datum _ltree_isparent(PG_FUNCTION_ARGS);
148+
Datum _ltree_risparent(PG_FUNCTION_ARGS);
149149

150150
/* Concatenation functions */
151-
extern PGDLLEXPORT Datum ltree_addltree(PG_FUNCTION_ARGS);
152-
extern PGDLLEXPORT Datum ltree_addtext(PG_FUNCTION_ARGS);
153-
extern PGDLLEXPORT Datum ltree_textadd(PG_FUNCTION_ARGS);
151+
Datum ltree_addltree(PG_FUNCTION_ARGS);
152+
Datum ltree_addtext(PG_FUNCTION_ARGS);
153+
Datum ltree_textadd(PG_FUNCTION_ARGS);
154154

155155
/* Util function */
156-
extern PGDLLEXPORT Datum ltree_in(PG_FUNCTION_ARGS);
156+
Datum ltree_in(PG_FUNCTION_ARGS);
157157

158158
bool ltree_execute(ITEM *curitem, void *checkval,
159159
bool calcnot, bool (*chkcond) (void *checkval, ITEM *val));

doc/src/sgml/xfunc.sgml

-17
Original file line numberDiff line numberDiff line change
@@ -2577,23 +2577,6 @@ concat_text(PG_FUNCTION_ARGS)
25772577
error messages to this effect.
25782578
</para>
25792579
</listitem>
2580-
2581-
<listitem>
2582-
<para>
2583-
To work correctly on Windows, <literal>C</>-language functions need
2584-
to be marked with <literal>PGDLLEXPORT</>, unless you use a build
2585-
process that marks all global functions that way. In simple cases
2586-
this detail will be handled transparently by
2587-
the <literal>PG_FUNCTION_INFO_V1</> macro. However, if you write
2588-
explicit external declarations (perhaps in header files), be sure
2589-
to write them like this:
2590-
<programlisting>
2591-
extern PGDLLEXPORT Datum funcname(PG_FUNCTION_ARGS);
2592-
</programlisting>
2593-
or you'll get compiler complaints when building on Windows. (On
2594-
other platforms, the <literal>PGDLLEXPORT</> macro does nothing.)
2595-
</para>
2596-
</listitem>
25972580
</itemizedlist>
25982581
</para>
25992582
</sect2>

src/include/fmgr.h

+4-3
Original file line numberDiff line numberDiff line change
@@ -350,11 +350,12 @@ typedef const Pg_finfo_record *(*PGFInfoFunction) (void);
350350
*
351351
* On Windows, the function and info function must be exported. Our normal
352352
* build processes take care of that via .DEF files or --export-all-symbols.
353-
* Module authors using a different build process might do it differently,
354-
* so we declare these functions PGDLLEXPORT for their convenience.
353+
* Module authors using a different build process might need to manually
354+
* declare the function PGDLLEXPORT. We do that automatically here for the
355+
* info function, since authors shouldn't need to be explicitly aware of it.
355356
*/
356357
#define PG_FUNCTION_INFO_V1(funcname) \
357-
extern PGDLLEXPORT Datum funcname(PG_FUNCTION_ARGS); \
358+
extern Datum funcname(PG_FUNCTION_ARGS); \
358359
extern PGDLLEXPORT const Pg_finfo_record * CppConcat(pg_finfo_,funcname)(void); \
359360
const Pg_finfo_record * \
360361
CppConcat(pg_finfo_,funcname) (void) \

0 commit comments

Comments
 (0)