#59 evc3/4: check if windows.h already included

closed
None
5
2006-11-27
2006-10-30
No

This patch adds a check to <stl/_windows.h> if
windows.h was already included. In this case we can
skip declaring the necessary Win32 functions. Patch is
for STLport 5.1 CVS branch.

Discussion

  • Francois Dumont

    Francois Dumont - 2006-11-12
    • assigned_to: nobody --> dums
     
  • Francois Dumont

    Francois Dumont - 2006-11-12

    Logged In: YES
    user_id=1096600

    Is this patch really necessary ? Having both declarations
    visible can give an opportunity to the compiler to report a
    coherency problem.

     
  • Michael Fink

    Michael Fink - 2006-11-13

    Logged In: YES
    user_id=124874

    There are two constellations when _windows.h is included on
    evc3/evc4. The first one is, a user includes e.g. <vector>,
    then includes <windows.h>. The second is, a user includes
    <windows.h> and then includes e.g. <vector>. In the first
    case, we need the forward declarations in _windows.h that
    are repeated in windows.h. Since the exact same signatures
    are used, there are no warnings about differently defined
    functions. In the second case, windows.h is already included
    and we don't have to do the forward references. The patch
    optimizes the second case by exactly doing that. Well, it
    doesn't optimize it but it removes errors about defines and
    functions being redefined.

     
  • Francois Dumont

    Francois Dumont - 2006-11-19

    Logged In: YES
    user_id=1096600
    Originator: NO

    An other remark, I checked the windows.h headers I have on my system. All are guarded with a _WINDOWS_ macro, in your patch you are checking __WINDOWS__, is it intentional ? Moreover you are checking _WINBASE_ for winbase.h, I know Microsoft is no always coherent in its code but this is surprising.

    I have plan to modify _windows.h to include windows.h when building the library. Do you think that it could avoid access to windows.h or winbase.h when using the lib ?

     
  • Michael Fink

    Michael Fink - 2006-11-25

    Logged In: YES
    user_id=124874
    Originator: YES

    The headers that come with the Platform SDK have the __WINDOWS__ macro in windows.h, and _WINBASE_ in winbase.h, and I think I copied them directly out of the file.

    About the comment to modify _windows.h so that it includes windows.h: I think that's ok, and then the above mentioned macros are good to check if the headers are included already, e.g. above the checks for evc3/4.

    If you have pressure to release 5.1, I think we could live without the patch, but the evc3/4 user must include STLport headers after including windows headers, which should be the case in about any project that is wizard-generated, be it an MFC application or other project types.

     
  • Francois Dumont

    Francois Dumont - 2006-11-27
    • status: open --> closed
     
  • Francois Dumont

    Francois Dumont - 2006-11-27

    Logged In: YES
    user_id=1096600
    Originator: NO

    Patch applied. Maybe we could have check _WINDOWS_ too but I will wait for feedback first.

     

Log in to post a comment.