Enhance FOO_EXPORT macro
Christian Ehrlicher
Ch.Ehrlicher at gmx.de
Fri May 4 09:11:44 BST 2007
Von: "Thiago Macieira" <thiago at kde.org>
> Christian Ehrlicher said:
> > Hi,
> >
> > I think FOO_EXPORT should be extented to
> >
> > #ifndef SOLID_EXPORT
> > # if defined _WIN32 || defined _WIN64
> > # if defined(MAKE_SOLID_LIB)
> > # define SOLID_EXPORT KDE_EXPORT
> > # else
> > # define SOLID_EXPORT KDE_IMPORT
> > # endif
> > # else /* UNIX */
> > # define SOLID_EXPORT KDE_EXPORT
> > # endif
> > #endif /* ndef */
>
> Why do we need to special-case the Windows branch? I see no reason to not
> use KDE_IMPORT in all branches. We are, after all, importing code from an
> existing library.
>
Maybe because KDE_IMPORT is not defined (correct) on linux?
#ifdef __KDE_HAVE_GCC_VISIBILITY
#define KDE_NO_EXPORT __attribute__ ((visibility("hidden")))
#define KDE_EXPORT __attribute__ ((visibility("default")))
#define KDE_IMPORT
But I don't know if it maybe breaks something when we define
KDE_IMPORT __attribute__ ((visibility("default")))
Any comments?
> > Sometimes (see solid) a static lib is created (to run the testcases
> > without the dependency to solid shared lib) which can't export symbols
> > (and cmake/kde does not define MAKE_FOO_EXPORT). In this case I added
> > something like this to cmakelists:
> >
> > set_target_properties(solid_static PROPERTIES COMPILE_FLAGS
> > -DSOLID_EXPORT=)
>
> Understood. This is probably easier than making the #ifdefs even more
> complex to detect a static build.
And we normally don't want static libs at all - adding ifdefs for a static lib would be counterproductive then.
Christian
--
"Feel free" - 10 GB Mailbox, 100 FreeSMS/Monat ...
Jetzt GMX TopMail testen: http://www.gmx.net/de/go/topmail
More information about the kde-core-devel
mailing list