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] |
Hi all, I'm writing (together with a friend) a cross platform library. however, I recently introduced the machanism to export only those *wanted* symbols. On the GCC/linux side, it's quite clear (for me) how to do this. But for the windows/MSVC side, I'm really not familar in any way. Now, to get the code together, we introduced a #macro that declares those symbols to be exportable like the following: // general API export/import macros #if defined(SW_GCC) # if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) // XXX visibility is available in GCC 3.4 and higher # define SW_EXPORT __attribute__((visibility("default"))) # define SW_NO_EXPORT __attribute__((visibility("hidden"))) # define SW_IMPORT /*!*/ # else # define SW_EXPORT /*!*/ # define SW_NO_EXPORT /*!*/ # define SW_IMPORT /*!*/ # endif #elif SW_WIN32 # define SW_EXPORT __declspec(dllexport) # define SW_NO_EXPORT /*!*/ # define SW_IMPORT /*__declspec(dllimport)*/ #else # define SW_EXPORT /*!*/ # define SW_NO_EXPORT /*!*/ # define SW_IMPORT /*!*/ #endif // SWL API export/import #if defined(MAKE_SWL) # define SWL_API SW_EXPORT #else # define SWL_API SW_IMPORT #endif Now, defining a symbol with this SW_EXPORT modifier is quite okay, but on the windows side, my friend says, he *NEEDS* this to be done for forward declarations as well. *ANYWHERE* he forward declares symbol "foo" to be exportable/importable, that symbol declaration has to have that SWL_API macro between as well. This doesn't like GCC (obviousely) and complains about like this: module.h:line: warning: type attributes are honored only at type definition in a line like this: template<class T> class SWL_API TSharedPtr; Now... in how far is this right and/or how could we find a Windows/Linux compatible macro-way to make each compiler/linker happy here? Thanks in advance, Christian Parpart. -- Netiquette: http://www.ietf.org/rfc/rfc1855.txt 00:10:38 up 56 days, 13:17, 2 users, load average: 1.44, 2.11, 1.92
Attachment:
pgp00000.pgp
Description: PGP signature
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |