Enhance FOO_EXPORT macro

Thiago Macieira thiago at kde.org
Fri May 4 09:01:16 BST 2007


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.

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

-- 
  Thiago Macieira  -  thiago (AT) macieira.info - thiago (AT) kde.org
    PGP/GPG: 0x6EF45358; fingerprint:
    E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358






More information about the kde-core-devel mailing list