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
-- v2: include: Don't use dllexport attribute for Wine PE modules.
From: Jacek Caban jacek@codeweavers.com
--- include/winnt.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/include/winnt.h b/include/winnt.h index d1c82084f9f..0af765652b7 100644 --- a/include/winnt.h +++ b/include/winnt.h @@ -180,7 +180,10 @@ extern "C" {
/* a couple of useful Wine extensions */
-#ifdef _MSC_VER +#if defined(__WINESRC__) && !defined(WINE_UNIX_LIB) +/* Wine uses .spec file for PE exports */ +# define DECLSPEC_EXPORT +#elif defined(_MSC_VER) # define DECLSPEC_EXPORT __declspec(dllexport) #elif defined(__MINGW32__) # define DECLSPEC_EXPORT __attribute__((dllexport))
On Wed Nov 15 15:37:08 2023 +0000, Alexandre Julliard wrote:
Wouldn't it be easier to simply #define DECLSPEC_EXPORT to nothing for PE builds?
Sure, I wasn't sure about that. Marking debug functions that are not meant to be exported with DECLSPEC_EXPORT seems a bit misleading, but it's not a big deal.
I used `!defined(WINE_UNIX_LIB)` instead of `__WINE_PE_BUILD` to also cover non-mingw builds.