Problem compiling shared DLL with visibility attributes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



hi,


I want to create a shared Library with the new gcc's visibility features as desribed in http://gcc.gnu.org/wiki/Visibility .

For every member in my classes I get a warning like:

g++ -O0 -g3 -Wall -c -fmessage-length=0 -fvisibility=hidden -oA.o ..\A.cpp
..\A.cpp: In member function 'void A::foo()':
..\A.cpp:17: warning: visibility attribute not supported in this configuration; ignored


Working with Windows XP, tdm-mingw-1.905.0-4.4.0-2, and eclipse gallileo with cdt (yep! ...Just started programming...).

Any thoughts?
Thanks in advance


==CompilerSettings.h==
#ifndef COMPILERSETTINGS_H
#define COMPILERSETTINGS_H
// @see http://gcc.gnu.org/wiki/Visibility for details

   // Generic helper definitions for shared library support
   #ifdef _MSC_VER   // Windows && MS Visual C
       #if _MSC_VER < 1310    //Version < 7.1?
#pragma message ("Compiling with a Visual C compiler version < 7.1 (2003) has not been tested!")
       #endif // Version > 7.1
       #define TESTLIB_HELPER_DLL_IMPORT __declspec(dllimport)
       #define TESTLIB_HELPER_DLL_EXPORT __declspec(dllexport)
       #define TESTLIB_HELPER_DLL_LOCAL
   #else
       #if __GNUC__ >= 4
#define TESTLIB_HELPER_DLL_IMPORT __attribute__ ((visibility("default"))) #define TESTLIB_HELPER_DLL_EXPORT __attribute__ ((visibility("default"))) #define TESTLIB_HELPER_DLL_LOCAL __attribute__ ((visibility("hidden")))
       #else
           #define TESTLIB_HELPER_DLL_IMPORT
           #define TESTLIB_HELPER_DLL_EXPORT
           #define TESTLIB_HELPER_DLL_LOCAL
       #endif
   #endif

// Now we use the generic helper definitions above to define TESTLIB_API and TESTLIB_LOCAL. // TESTLIB_API is used for the public API symbols. It either DLL imports or DLL exports (or does nothing for static build)
// TESTLIB_LOCAL is used for non-api symbols.

#ifdef TESTLIB_DLL // defined if TESTLIB is compiled as a DLL
#ifdef TESTLIB_DLL_EXPORTS // defined if we are building the TESTLIB DLL (instead of using it)
       #define DLL_PUBLIC TESTLIB_HELPER_DLL_EXPORT
   #else
       #define DLL_PUBLIC TESTLIB_HELPER_DLL_IMPORT
   #endif // TESTLIB_DLL_EXPORTS
   #define DLL_LOCAL TESTLIB_HELPER_DLL_LOCAL
#else // TESTLIB_DLL is not defined: this means TESTLIB is a static lib.
   #define DLL_PUBLIC
   #define DLL_LOCAL
#endif // TESTLIB_DLL

#endif //COMPILERSETTINGS_H
==CompilerSettings.h==


==A.h==
#ifndef A_H_
#define A_H_

#define TESTLIB_DLL
#define TESTLIB_DLL_EXPORTS

#include "CompilerSettings.h"

class DLL_PUBLIC A
{
public:
   A();
   virtual ~A();

   DLL_LOCAL void foo();
   DLL_PUBLIC void bar();
};
#endif /* A_H_ */
==A.h==


==A.cpp==
#include "A.h"
A::A() {}
A::~A() {}
void A::foo() {}
void A::bar() {}
==A.cpp==


==FULL eclipse Ouput==
**** Internal Builder is used for build               ****
g++ -O0 -g3 -Wall -c -fmessage-length=0 -fvisibility=hidden -oA.o ..\A.cpp
..\A.cpp: In member function 'void A::foo()':
..\A.cpp:17: warning: visibility attribute not supported in this configuration; ignored
g++ -shared -Wl,--out-implib=libTestVisibility.a -olibtestVisibility.dll A.o
Creating library file: libTestVisibility.a
Build complete for project testVisibility
Time consumed: 4547 ms. ==FULL eclipse Ouput==






[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux