Re: narwhal and PGDLLIMPORT - Mailing list pgsql-hackers

From Tom Lane
Subject Re: narwhal and PGDLLIMPORT
Date
Msg-id 16324.1391898872@sss.pgh.pa.us
Whole thread Raw
In response to Re: narwhal and PGDLLIMPORT  (Hiroshi Inoue <inoue@tpf.co.jp>)
Responses Re: narwhal and PGDLLIMPORT  (Andres Freund <andres@2ndquadrant.com>)
Re: narwhal and PGDLLIMPORT  (Andrew Dunstan <andrew@dunslane.net>)
Re: narwhal and PGDLLIMPORT  (Amit Kapila <amit.kapila16@gmail.com>)
List pgsql-hackers
Hiroshi Inoue <inoue@tpf.co.jp> writes:
> Though I'm not a MINGW expert at all, I know dllwrap is a deprecated
> tool and dlltool is almost a deprecated tool. Cygwin port is removing
> the use of dllwrap and dlltool now. Isn't it better for MINGW port to
> follow it?

Only way to make that happen is to prepare and test a patch ...

In the meantime, here's a short patch trying the "#define extern" approach.
Anyone want to try this on a Windows machine or two?  Or we could just
commit it in HEAD for long enough to see what the buildfarm says.

            regards, tom lane

*** /home/postgres/pgsql/src/include/c.h    Fri Jan 17 15:57:23 2014
--- new/c.h    Sat Feb  8 17:19:00 2014
*************** extern int    vsnprintf(char *str, size_t c
*** 961,973 ****
  #define memmove(d, s, c)        bcopy(s, d, c)
  #endif

! /* no special DLL markers on most ports */
! #ifndef PGDLLIMPORT
  #define PGDLLIMPORT
- #endif
- #ifndef PGDLLEXPORT
  #define PGDLLEXPORT
- #endif

  /*
   * The following is used as the arg list for signal handlers.  Any ports
--- 961,969 ----
  #define memmove(d, s, c)        bcopy(s, d, c)
  #endif

! /* we don't use special DLL markers in declarations anymore */
  #define PGDLLIMPORT
  #define PGDLLEXPORT

  /*
   * The following is used as the arg list for signal handlers.  Any ports
*** /home/postgres/pgsql/src/include/port/cygwin.h    Tue Jul 23 13:41:12 2013
--- new/cygwin.h    Sat Feb  8 17:22:32 2014
***************
*** 10,18 ****
  #endif

  #ifdef BUILDING_DLL
! #define PGDLLIMPORT __declspec (dllexport)
  #else
! #define PGDLLIMPORT __declspec (dllimport)
  #endif
-
- #define PGDLLEXPORT
--- 10,16 ----
  #endif

  #ifdef BUILDING_DLL
! #define extern    extern __declspec (dllexport)
  #else
! #define extern    extern __declspec (dllimport)
  #endif
*** /home/postgres/pgsql/src/include/port/win32.h    Sun Jan 26 22:38:59 2014
--- new/win32.h    Sat Feb  8 17:26:53 2014
***************
*** 73,93 ****
   */

  #if defined(WIN32) || defined(__CYGWIN__)
-
  #ifdef BUILDING_DLL
! #define PGDLLIMPORT __declspec (dllexport)
  #else                            /* not BUILDING_DLL */
! #define PGDLLIMPORT __declspec (dllimport)
! #endif
!
! #ifdef _MSC_VER
! #define PGDLLEXPORT __declspec (dllexport)
! #else
! #define PGDLLEXPORT
  #endif
- #else                            /* not CYGWIN, not MSVC, not MingW */
- #define PGDLLIMPORT
- #define PGDLLEXPORT
  #endif


--- 73,83 ----
   */

  #if defined(WIN32) || defined(__CYGWIN__)
  #ifdef BUILDING_DLL
! #define extern    extern __declspec (dllexport)
  #else                            /* not BUILDING_DLL */
! #define extern    extern __declspec (dllimport)
  #endif
  #endif


*************** typedef int pid_t;
*** 347,354 ****


  /* In backend/port/win32/signal.c */
! extern PGDLLIMPORT volatile int pg_signal_queue;
! extern PGDLLIMPORT int pg_signal_mask;
  extern HANDLE pgwin32_signal_event;
  extern HANDLE pgwin32_initial_signal_pipe;

--- 337,344 ----


  /* In backend/port/win32/signal.c */
! extern volatile int pg_signal_queue;
! extern int pg_signal_mask;
  extern HANDLE pgwin32_signal_event;
  extern HANDLE pgwin32_initial_signal_pipe;


pgsql-hackers by date:

Previous
From: Thom Brown
Date:
Subject: Re: Changeset Extraction v7.5
Next
From: Andres Freund
Date:
Subject: Re: Changeset Extraction v7.5