That makes sense to me.

Get Outlook for iOS<https://aka.ms/o0ukef>
________________________________
From: Openexr-devel <openexr-devel-bounces+meshula=hotmail....@nongnu.org> on 
behalf of Etienne Sandré-Chardonnal <etienne.san...@m4x.org>
Sent: Wednesday, January 3, 2018 7:26:52 AM
To: openexr-devel@nongnu.org
Subject: [Openexr-devel] Issue when compiling with MinGW and pthreads

Dear OpenEXR developpers,

I have an old issue when building IlmBase with MinGW, which is still there in 
2.2.1

MinGW comes in two thread API flavors : the win32 or pthreads API. The most 
widely used is the pthread flavor, as shown on the sourceforge download page:

https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/7.2.0/

However, the thread part of IlmBase uses that preprocessor code:

#if defined _WIN32 || defined _WIN64
    #ifdef NOMINMAX
        #undef NOMINMAX
    #endif
    #define NOMINMAX
    #include <windows.h>
    #include <process.h>
#elif HAVE_PTHREAD
    #include <pthread.h>
#endif

With MinGW pthread flavor, _WIN32 is always defined, and autoconf properly sets 
the HAVE_PTHREAD macro. Which means both are defined. The above preprocessor 
code then includes the Win32 API which is incorrect, causing compile errors. 
Replacing the whole preprocessor block by:

    #include <pthread.h>

In all threading ilmbase source solves the issue.

Would it be possible to patch this? I think that first testing for 
HAVE_PTHREADS and testing for _WIN32 if the first is not set would solve the 
issue, without harm to other platforms and compilers. What do you think?

Thanks!
_______________________________________________
Openexr-devel mailing list
Openexr-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/openexr-devel

Reply via email to