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

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

 



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 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