[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Openexr-devel] Issue when compiling with MinGW and pthreads

From: Etienne Sandré-Chardonnal
Subject: [Openexr-devel] Issue when compiling with MinGW and pthreads
Date: Wed, 3 Jan 2018 16:26:52 +0100

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:

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

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

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?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]