Browse Source

Audio, GL: (attempt to) fix MinGW GCC warnings on static Windows builds.

The CI doesn't have this configuration in the build matrix, so hoping
it's doing what it's supposed to.
pull/388/head
Vladimír Vondruš 7 years ago
parent
commit
a85d24ad17
  1. 8
      src/Magnum/Audio/Context.cpp
  2. 1
      src/Magnum/GL/Context.cpp

8
src/Magnum/Audio/Context.cpp

@ -142,8 +142,12 @@ CORRADE_VISIBILITY_EXPORT
Context* currentContext = nullptr;
#else
/* On Windows the symbol is exported unmangled and then fetched via
GetProcAddress() to emulate weak linking. */
extern "C" CORRADE_VISIBILITY_EXPORT Context* magnumAudioUniqueCurrentContext = nullptr;
GetProcAddress() to emulate weak linking. Using an extern "C" block instead
of just a function annotation because otherwise MinGW prints a warning:
'...' initialized and declared 'extern' (uh?) */
extern "C" {
CORRADE_VISIBILITY_EXPORT Context* magnumAudioUniqueCurrentContext = nullptr;
}
#endif
#if !defined(MAGNUM_BUILD_STATIC) || defined(CORRADE_TARGET_WINDOWS)

1
src/Magnum/GL/Context.cpp

@ -513,6 +513,7 @@ Context* currentContext = nullptr;
called from. To avoid #ifdef hell in code below, the currentContext is
redefined to return a value from this uniqueness-ensuring function. */
#if defined(CORRADE_TARGET_WINDOWS) && defined(MAGNUM_BUILD_STATIC) && !defined(CORRADE_TARGET_WINDOWS_RT)
extern "C" CORRADE_VISIBILITY_EXPORT Context*& magnumGLUniqueCurrentContext();
extern "C" CORRADE_VISIBILITY_EXPORT Context*& magnumGLUniqueCurrentContext() {
return currentContext;
}

Loading…
Cancel
Save