A very dangerous define in wincore.h

  • Todor Totev

    Todor Totev - 2009-05-28

    I found a very dangerous define in wincore.h which has potential to break code.
    The problem is that wincore defines:


    This breaks the code afterwards unless the user includes commdlg.h BEFORE win32++ headers, which is not documented and unexpected.

    Possible fix 1: check compiler version as the comment suggests and do this define for VC6 only
    possible fix 2: include commdlg.h in wincore.h

    • David

      David - 2009-05-30

      Actually you should not include commdlg.h in your code at all.  That is the job of the windows.h header file. Windows.h will skip the inclusion of commdlg.h if WIN32_LEAN_AND_MEAN is defined. If you need to use the features included by commdlg.h, don't define WIN32_LEAN_AND_MEAN.


      • Todor Totev

        Todor Totev - 2009-05-30

        My code outside Win32++ does not need all aditional stuff included when WIN32_LEAN_AND_MEAN is defined, so why make compile times longer? Even with precompiled headers full recompilation of our code base is almost 4 hours. Anyway, there's no need to argue here, I'll just keep adding #include <commdlg.h> every time I sync with your releases.

    • David

      David - 2009-06-01

      Fair enough.

      Since you mentioned compiled times of almost 4 hours, you might find the StaticLibrary useful. It might help reduce your compile times.

      • Todor Totev

        Todor Totev - 2009-06-01

        Thanks for the tip, I'll look into it


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks