[vtkusers] Win32 : VTK headers cleanup

REGAT-BARREL Aurélien arbvtk at yahoo.fr
Wed Dec 1 06:08:47 EST 2004


Hi,
I worked on VTK headers and I think the following minor corrections could be done:
 
-----------------------------------
In vtkObjectBase.h
 
#include "vtkIndent.h"
#include "vtkSystemIncludes.h"

Including vtkSystemIncludes.h is not needed, because it is already done by vtkIndent.h
 
-----------------------------------
In vtkMutexLock.h    and
In vtkCriticalSection.h
 
remove the inclusion of
#include <winbase.h>
 
which is already done with <windows.h> through vtkObjectBase->vtkSystemIncludes->vtkWin32Header.h
 
----------------------------------
The same with
vtkDynamicLoader.cxx
vtkDirectory.cxx
 
which include
#include <windows.h>
 
Moreover vtkDirectory.cxx doesn't need <windows.h>
 
-----------------------------------
-----------------------------------
 
I also propose to add some #define before including <windows.h> in vtkWin32Header.h.
Actually we have:
 
#ifndef STRICT
#define STRICT
#endif
#ifdef VTK_USE_ANSI_STDLIB
#ifndef NOMINMAX
#define NOMINMAX
#endif
#endif

#include <windows.h>

 
I propose to add at least WIN32_LEAN_AND_MEAN which significantly reduce <windows.h> size and speeds up compile time.
I found that the following definitions:
 
#define WIN32_LEAN_AND_MEAN
#define NOSERVICE
#define NOMCX
#define NOIME
#define NONLS

Reduced compile time by 40% on my computer. I also propose to #undef some Win32 macros which conflicts with VTK function names:
#undef CreateDirectory
#undef GetClassName
#undef GetProp
#undef RemoveProp
//#undef SetProp

This solves some problems with VTK under windows, in particular when compiling in UNICODE (error likes "could not find GetClassNameW", etc...)
So I propose to replace
 
#include <windows.h>
 
by
 
#define WIN32_LEAN_AND_MEAN
#define NOSERVICE
#define NOMCX
#define NOIME
#define NONLS

#include <windows.h>

#undef CreateDirectory
#undef GetClassName
#undef GetProp
#undef RemoveProp
#undef SetProp
//#undef SendMessage

No code is broken, except if you #undef SendMessage (conflicts with vtkSocketCommunicator::SendMessage), vtkWin32OutputWindow.cxx will not compile.
 
For more details you can read:
http://aurelien_regat-barrel.blogspot.com/
 
Regards.
 



Aurélien REGAT-BARREL 
My VTK blog : http://aurelien_regat-barrel.blogspot.com


		
---------------------------------
Créez gratuitement votre Yahoo! Mail avec 100 Mo de stockage !
Créez votre Yahoo! Mail

Le nouveau Yahoo! Messenger est arrivé ! Découvrez toutes les nouveautés pour dialoguer instantanément avec vos amis.Téléchargez GRATUITEMENT ici !
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20041201/868577e5/attachment.htm>


More information about the vtkusers mailing list