Hi, if found some incompatibilities when compiling on
windows/mingw32. 1. libnetmd/common.c : sleep() is not defined/implemented I fixed this using windows Sleep() function by adding following lines to common.c #ifdef WIN32 /* use windows internal Sleep() function */ #include <windows.h> #define sleep(x) Sleep(x) #endif
2. libnetmd/utils.h and utils.c : "int min(int a,int b)" is already defined in windows.h I fixed this by defining NOMINMAX to not use the windows function. I just added following line to libnetmd.pro and netmdcli.pro win32:DEFINES += NOMINMAX 3. libnetmd/utils.h : missind definition of ETIMEDOUT in errno.h I fixed this by defining it. #ifdef WIN32 /* add missing definitions for errno on windows */ #define ETIMEDOUT 70 // Operation timed out #endif
4. libnetmd/secure.c and netmdcli/netmdcli.c : ramdom() is not defined and implemented I fixed this as a "bloody hack" in utils.h using #ifdef WIN32 #include <stdlib.h> #include <time.h> static int random(){srand(time(NULL));return rand();}; #endif
But i think it´s better to use a rondom number generating function which is available on all platforms, maybe use one from libgcrypt. I´ll send a patch later after we have discussed the random() problem. Regards Thomas |