vendredi 31 juillet 2015

C program compiler errors only in Windows (MinGW-w64)

I built a multi-language software image processing program and made it generally available with binaries for Mac OS X and Ubuntu. The binaries have been tested on their respective operating systems and every thing works perfectly. I recently also tried to release binaries for Windows (64 bit) but the GCC (through MinGW-w64) compiler gave me errors for one of the C programs when I create the shared library (dll) file. This did not happen in Mac OS X or Ubuntu. The program now quits unexpectedly when I run it (happens when it reaches the C file in question). Here are the errors and the corresponding line of code in the c file:

warning: passing argument 3 of '_beginthreadex' from incompatible pointer type [enabled by default]

Line 464:

ThreadList[i] = (HANDLE)_beginthreadex( NULL, 0, &ThreadFunc, &ThreadArgs[i] , 0, NULL ); 

The second and stranger warning:

    c:\mingw\x86_64-w64-mingw32\include\process.h:31:29: note: 
expected 'unsigned int <*><void *>' but argument is of type 'void * <*><void *>'
    _CRTIMP uintptr_t _cdecl _beginthreadex<void *_Security,unsigned _Stacksize,unsigned <_stdcall *_StartAddress> <void *>,void *_ArgList,unsigned _InitFlag,unsigned *_ThrdAddr  >;

Line 34:

#include <process.h>

The two warnings seem connected but I have no idea how to fix this. The full C program is here .

Aucun commentaire:

Enregistrer un commentaire