KDE_EXPORT question

Allen Winter winter at kde.org
Sat Apr 29 15:39:08 BST 2006

On Saturday 29 April 2006 03:31, Andras Mantia wrote:
> Hi,
>  I have a question regarding the above define. Why should every library 
> define its own *_EXPORT and not use KDE_EXPORT directly? Is this 
> mandatory?

I've been working on the *_EXPORT issue in kdepim recently as well.

Here's what I think to be true:
 1. yes, each library "foo" needs its own FOO_EXPORT
 2. each public class should be FOO_EXPORTed.
 3. each class file fooclass.h should include "kdemodule_export.h" (kwebdev_export.h??)
   kdemodule_export.h needs to be someplace in your module that all libraries can access
 4. kdemodule_export.h should have a section like this
      #if defined _WIN32 || defined _WIN64 
      # include <kdemodule_export_win.h>
      #else /* UNIX */
      /* export statements for unix */
      #define KHOLIDAYS_EXPORT KDE_EXPORT  //for example
     /* put all your FOO_EXPORT KDE_EXPORT defines here

5. kdemodule_export_win.h should reside in the same dir as kdemodule_export.h
6. kdemodule_export_win.h should have sections like the following for each FOO_EXPORT:

      #ifndef KHOLIDAYS_EXPORT
      # ifdef MAKE_KHOLIDAYS_LIB
      # else
      # endif

7. probably other stuff that I'm forgetting

You might want to look in kdepim/libkholidays_ng and kdepim/libkdepim (for the kdepim_export*.h files)
for an example. 

Regards, Allen
[1] http://wiki.kde.org/tiki-index.php?page=KDElibs%2Fwin32+Porting+Guidelines
Let's Keep the Political Talk Out of KDE PLEASE

More information about the kde-core-devel mailing list