martin-olivier / dylib

C++ cross-platform wrapper around dynamic loading of shared libraries (dll, so, dylib)

Home Page:https://conan.io/center/recipes/dylib

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Avoid compiler warnings about initializing externs

eyalroz opened this issue · comments

When building with GCC 10.2.1, I get:

/path/to/dylib/tests/lib.cpp:4:18: warning: ‘pi_value’ initialized and declared ‘extern’
    4 | DYLIB_API double pi_value = 3.14159;
      |                  ^~~~~~~~
/path/to/src/dylib/tests/lib.cpp:5:17: warning: ‘ptr’ initialized and declared ‘extern’
    5 | DYLIB_API void *ptr = (void *)1;
      |                 ^~~

The point is that either you declare something extern (coming from elsewhere), or you initialize it, but not both on the same line.

Hi, I just made your requested changes on #26

Also referenced in #35.
I will close this issue