Recent change to make unixlibs use hidden visibility made DECLSPEC_EXPORT being used in more cases. This means that it's used for PE modules as well, which is meant to be ignored since we use .spec files and winebuild-generated .edata anyway. This has some side effects:
- LLD correctly ignores dllexport when it detects .edata presence, but it also issues a warning: `lld-link: warning: literal .edata sections override exports`
- AFAIR (I didn't verify), GNU LD would still generate its own .edata entries, but the one provided by winebuild will be actually used by PE header
- non-mingw builds will use default visibility for those symbols in PE modules
From: Jacek Caban jacek@codeweavers.com
--- include/wine/debug.h | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/include/wine/debug.h b/include/wine/debug.h index 86e008a1408..a8a07db5a84 100644 --- a/include/wine/debug.h +++ b/include/wine/debug.h @@ -108,12 +108,18 @@ struct __wine_debug_channel #define WINE_FIXME_(ch) WINE_FIXME #endif
+#ifdef WINE_UNIX_LIB +#define WINEDBGAPI DECLSPEC_EXPORT +#else +#define WINEDBGAPI +#endif + NTSYSAPI int WINAPI __wine_dbg_write( const char *str, unsigned int len ); -extern DECLSPEC_EXPORT unsigned char __cdecl __wine_dbg_get_channel_flags( struct __wine_debug_channel *channel ); -extern DECLSPEC_EXPORT const char * __cdecl __wine_dbg_strdup( const char *str ); -extern DECLSPEC_EXPORT int __cdecl __wine_dbg_output( const char *str ); -extern DECLSPEC_EXPORT int __cdecl __wine_dbg_header( enum __wine_debug_class cls, struct __wine_debug_channel *channel, - const char *function ); +extern WINEDBGAPI unsigned char __cdecl __wine_dbg_get_channel_flags( struct __wine_debug_channel *channel ); +extern WINEDBGAPI const char * __cdecl __wine_dbg_strdup( const char *str ); +extern WINEDBGAPI int __cdecl __wine_dbg_output( const char *str ); +extern WINEDBGAPI int __cdecl __wine_dbg_header( enum __wine_debug_class cls, struct __wine_debug_channel *channel, + const char *function );
/* * Exported definitions and macros
From: Jacek Caban jacek@codeweavers.com
--- include/dde.h | 4 +++- include/ddeml.h | 4 +++- include/ntgdi.h | 4 +++- include/ntuser.h | 4 +++- include/rpc.h | 2 ++ include/twain.h | 17 ++++++++++++----- include/wingdi.h | 4 +++- include/winnt.h | 4 +++- include/winuser.h | 8 +++++--- 9 files changed, 37 insertions(+), 14 deletions(-)
diff --git a/include/dde.h b/include/dde.h index 7b236414dac..c7e4448e221 100644 --- a/include/dde.h +++ b/include/dde.h @@ -29,8 +29,10 @@ extern "C" { #endif
#ifndef WINUSERAPI -#if defined(_USER32_) || defined(WINE_UNIX_LIB) +#if defined(WINE_UNIX_LIB) #define WINUSERAPI DECLSPEC_EXPORT +#elif defined(_USER32_) +#define WINUSERAPI #else #define WINUSERAPI DECLSPEC_IMPORT #endif diff --git a/include/ddeml.h b/include/ddeml.h index 0bffa851c79..bf5859c4a6d 100644 --- a/include/ddeml.h +++ b/include/ddeml.h @@ -27,8 +27,10 @@ extern "C" { #endif /* defined(__cplusplus) */
#ifndef WINUSERAPI -#if defined(_USER32_) || defined(WINE_UNIX_LIB) +#if defined(WINE_UNIX_LIB) #define WINUSERAPI DECLSPEC_EXPORT +#elif defined(_USER32_) +#define WINUSERAPI #else #define WINUSERAPI DECLSPEC_IMPORT #endif diff --git a/include/ntgdi.h b/include/ntgdi.h index c2cb1924730..14e2a503286 100644 --- a/include/ntgdi.h +++ b/include/ntgdi.h @@ -25,8 +25,10 @@ #include <ddk/d3dkmthk.h>
#ifndef W32KAPI -# if defined(_WIN32U_) || defined(WINE_UNIX_LIB) +# if defined(WINE_UNIX_LIB) # define W32KAPI DECLSPEC_EXPORT +# elif defined(_WIN32U_) +# define W32KAPI # else # define W32KAPI DECLSPEC_IMPORT # endif diff --git a/include/ntuser.h b/include/ntuser.h index def89a82aff..8eb6b2c71c8 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -26,8 +26,10 @@ #include <winternl.h>
#ifndef W32KAPI -# if defined(_WIN32U_) || defined(WINE_UNIX_LIB) +# if defined(WINE_UNIX_LIB) # define W32KAPI DECLSPEC_EXPORT +# elif defined(_WIN32U_) +# define W32KAPI # else # define W32KAPI DECLSPEC_IMPORT # endif diff --git a/include/rpc.h b/include/rpc.h index 2d4323428c4..cc1d9c8e1e3 100644 --- a/include/rpc.h +++ b/include/rpc.h @@ -42,6 +42,8 @@ #ifndef RPCRTAPI #if !defined(_RPCRT4_) && !defined(_KRPCENV_) #define RPCRTAPI DECLSPEC_IMPORT +#elif defined(__WINESRC__) +#define RPCRTAPI #else #define RPCRTAPI DECLSPEC_EXPORT #endif diff --git a/include/twain.h b/include/twain.h index 28eaddf0840..455126e6b21 100644 --- a/include/twain.h +++ b/include/twain.h @@ -1817,11 +1817,18 @@ typedef TW_UINT16 (*DSMENTRYPROC)(pTW_IDENTITY, pTW_IDENTITY, extern "C" { #endif /* __cplusplus */ #ifdef _MSWIN_ - TW_UINT16 DECLSPEC_EXPORT PASCAL DS_Entry (pTW_IDENTITY pOrigin, - TW_UINT32 DG, - TW_UINT16 DAT, - TW_UINT16 MSG, - TW_MEMREF pData); + +#ifdef __WINESRC__ +# define TWAIN_EXPORT +#else +# define TWAIN_EXPORT DECLSPEC_EXPORT +#endif + + TW_UINT16 TWAIN_EXPORT PASCAL DS_Entry (pTW_IDENTITY pOrigin, + TW_UINT32 DG, + TW_UINT16 DAT, + TW_UINT16 MSG, + TW_MEMREF pData);
typedef TW_UINT16 (FAR PASCAL *DSENTRYPROC) (pTW_IDENTITY pOrigin, TW_UINT32 DG, diff --git a/include/wingdi.h b/include/wingdi.h index ff0bbb6fc85..f1cdfef3a45 100644 --- a/include/wingdi.h +++ b/include/wingdi.h @@ -25,8 +25,10 @@ extern "C" { #endif
#ifndef WINGDIAPI -#if defined(_GDI32_) || defined(WINE_UNIX_LIB) +#if defined(WINE_UNIX_LIB) #define WINGDIAPI DECLSPEC_EXPORT +#elif defined(_GDI32_) +#define WINGDIAPI #else #define WINGDIAPI DECLSPEC_IMPORT #endif diff --git a/include/winnt.h b/include/winnt.h index d1c82084f9f..8a6e8e6850a 100644 --- a/include/winnt.h +++ b/include/winnt.h @@ -42,8 +42,10 @@ extern "C" { #endif
-#if defined(_NTSYSTEM_) || defined(WINE_UNIX_LIB) +#if defined(WINE_UNIX_LIB) #define NTSYSAPI DECLSPEC_EXPORT +#elif defined(_NTSYSTEM_) +#define NTSYSAPI #else #define NTSYSAPI DECLSPEC_IMPORT #endif diff --git a/include/winuser.h b/include/winuser.h index 73e7919aaea..f8aa471631d 100644 --- a/include/winuser.h +++ b/include/winuser.h @@ -20,10 +20,12 @@ #define _WINUSER_
#ifndef WINUSERAPI -#if !defined(_USER32_) && !defined(WINE_UNIX_LIB) -#define WINUSERAPI DECLSPEC_IMPORT -#else +#if defined(WINE_UNIX_LIB) #define WINUSERAPI DECLSPEC_EXPORT +#elif defined(_USER32_) +#define WINUSERAPI +#else +#define WINUSERAPI DECLSPEC_IMPORT #endif #endif
Wouldn't it be easier to simply #define DECLSPEC_EXPORT to nothing for PE builds?