fatal error if KDE compiles with hidden visibility but Q_DECL_EXPORT is defined to nothing

Thiago Macieira thiago at kde.org
Thu Jun 21 14:18:03 CEST 2007


Matthias Kretz said:
> Hi,
>
> as I just got my second report that phonon doesn't link I thought I'd
> better
> implement a check that errors out if Qt has been compiled without
> visibility
> support but KDE is compiled with default hidden visibility.
>
> This is necessary for
> 1. phonon which uses Q_DECL_EXPORT as export macro
> 2. all plugins that export their entry symbols using Q_DECL_EXPORT or any
> other macro that uses Q_DECL_EXPORT
>
> Ok, to commit the attached patch?

It's much easier and even probably better to define KDE_EXPORT as
Q_DECL_EXPORT (similarly for KDE_IMPORT).

The reason we don't do that is because qglobal.h cannot be included from C
source files -- though IMHO it should.

So I'd say the following (radical position):
1) change kdemacros.h.cmake to:
#ifdef __cplusplus
  #define KDE_EXPORT   Q_DECL_EXPORT
  #define KDE_IMPORT   Q_DECL_IMPORT
#else
  #define KDE_EXPORT
  #define KDE_IMPORT
#endif

The definition of KDE_NO_EXPORT can stay, especially because Qt has no
equivalent.

2) No C source file can export symbols, period. We don't produce C
libraries in KDE. However, unmangled symbols can easily be exported from
C++ source files by using extern "C".

-- 
  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-buildsystem mailing list