This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gcc can not distinguish the same file or same class with the different module or library


Hi XiaGuangTai,

On my project, we use these tags:

// Windows using VC++
#define EXPORT __declspec(dllimport)
#define CLASS_EXPORT

NOTE: VC++ uses a "flippy" EXPORT macro.  It's __declspec(dllexport) when
building the library, and __declspec(dllimport) when using the library.

// Using GCC, with visibility set to "hidden" for the project.
#define EXPORT __attribute__((visibility("default")))
#define CLASS_EXPORT __attribute__((visibility("default")))

Then we have classes like:

class CLASS_EXPORT Foo
{
public:
  EXPORT Foo();
  EXPORT Foo(int);
  EXPORT Foo(double);
  EXPORT virtual ~Foo();
};

Is that the sort of declare control you are looking for?

Side note, the CLASS_EXPORT is needed for GCC so the RTTI information is
externally visible.  Otherwise you may run into problems with exception
handling and typeid.

Sincerely,
--Eljay


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]